chore: update DRM example (#4259)

This commit is contained in:
Krzysztof Moch 2024-10-26 14:55:11 +02:00 committed by GitHub
parent 3b4bfd3936
commit f850b7a71c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 13 deletions

View File

@ -2,18 +2,23 @@ import PlatformsList from '../../components/PlatformsList/PlatformsList.tsx';
# DRM
> **Note:** DRM is not supported on visionOS yet.
## DRM Example
We have avaliable example for DRM usage in the [example app](https://github.com/TheWidlarzGroup/react-native-video/blob/master/examples/bare/src/DRMExample.tsx).
To get token needed for DRM playback you can go to [our site]() and get it.
## Provide DRM data (only tested with http/https assets)
You can provide some configuration to allow DRM playback.
This feature will disable the use of `TextureView` on Android.
```jsx
DRM object allows this members:
### `base64Certificate`
<PlatformsList types={['iOS']} />
<PlatformsList types={['iOS', 'visionOS']} />
Type: bool\
Default: false
@ -22,7 +27,7 @@ Whether or not the certificate url returns it on base64.
### `certificateUrl`
<PlatformsList types={['iOS']} />
<PlatformsList types={['iOS', 'visionOS']} />
Type: string\
Default: undefined
@ -31,7 +36,7 @@ URL to fetch a valid certificate for FairPlay.
### `getLicense`
<PlatformsList types={['iOS']} />
<PlatformsList types={['iOS', 'visionOS']} />
Type: function\
Default: undefined
@ -79,7 +84,7 @@ getLicense: (spcString, contentId, licenseUrl, loadedLicenseUrl) => {
### `contentId`
<PlatformsList types={['iOS']} />
<PlatformsList types={['iOS', 'visionOS']} />
Type: string\
Default: undefined
@ -88,7 +93,7 @@ Specify the content id of the stream, otherwise it will take the host value from
### `headers`
<PlatformsList types={['Android', 'iOS']} />
<PlatformsList types={['Android', 'iOS', 'visionOS']} />
Type: Object\
Default: undefined
@ -112,7 +117,7 @@ drm={{
### `licenseServer`
<PlatformsList types={['Android', 'iOS']} />
<PlatformsList types={['Android', 'iOS', 'visionOS']} />
Type: string\
Default: false
@ -139,7 +144,7 @@ for iOS: DRMType.FAIRPLAY
### `localSourceEncryptionKeyScheme`
<PlatformsList types={['iOS']} />
<PlatformsList types={['iOS', 'visionOS']} />
Set the url scheme for stream encryption key for local assets

View File

@ -20,19 +20,19 @@ const DRMExample = () => {
const [source, setSource] = React.useState<SourceType>(null);
const [hls, setHls] = React.useState(
'https://d5lhbv70lxyop.cloudfront.net/02b91d1c-dcde-4a93-8391-8524f7836a72/assets/5a116d5e-4acb-4461-8bc0-81adf45a8432/videokit-576p-dash-hls-drm/hls/index.m3u8',
'https://d2e67eijd6imrw.cloudfront.net/559c7a7e-960d-4cd8-9dba-bc4e59890177/assets/47cfca69-91b5-4311-bf6c-b9b1f297ed9b/videokit-720p-dash-hls-drm/hls/index.m3u8',
);
const [fairplayLicense, setFairplayLicense] = React.useState(
'https://videokit-demo-7dr2zvpf.la.drm.cloud/acquire-license/fairplay?BrandGuid=02b91d1c-dcde-4a93-8391-8524f7836a72',
'https://thewidlarzgroup.la.drm.cloud/acquire-license/fairplay?brandGuid=559c7a7e-960d-4cd8-9dba-bc4e59890177',
);
const [fairplayCertificate, setFairplayCertificate] = React.useState(
'https://videokit-demo-7dr2zvpf.la.drm.cloud/certificate/fairplay?BrandGuid=02b91d1c-dcde-4a93-8391-8524f7836a72',
'https://thewidlarzgroup.la.drm.cloud/certificate/fairplay?brandGuid=559c7a7e-960d-4cd8-9dba-bc4e59890177',
);
const [dash, setDash] = React.useState(
'https://d5lhbv70lxyop.cloudfront.net/02b91d1c-dcde-4a93-8391-8524f7836a72/assets/5a116d5e-4acb-4461-8bc0-81adf45a8432/videokit-576p-dash-hls-drm/dash/index.mpd',
'https://d2e67eijd6imrw.cloudfront.net/559c7a7e-960d-4cd8-9dba-bc4e59890177/assets/47cfca69-91b5-4311-bf6c-b9b1f297ed9b/videokit-720p-dash-hls-drm/dash/index.mpd',
);
const [widevineLicense, setWidevineLicense] = React.useState(
'https://videokit-demo-7dr2zvpf.la.drm.cloud/acquire-license/widevine?BrandGuid=02b91d1c-dcde-4a93-8391-8524f7836a72',
'https://thewidlarzgroup.la.drm.cloud/acquire-license/widevine?brandGuid=559c7a7e-960d-4cd8-9dba-bc4e59890177',
);
// ------------- DMR Token -------------