Skip to content

Commit

Permalink
chore: update DRM example (#4259)
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMoch authored Oct 26, 2024
1 parent 3b4bfd3 commit f850b7a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
21 changes: 13 additions & 8 deletions docs/pages/component/drm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -31,7 +36,7 @@ URL to fetch a valid certificate for FairPlay.

### `getLicense`

<PlatformsList types={['iOS']} />
<PlatformsList types={['iOS', 'visionOS']} />

Type: function\
Default: undefined
Expand Down Expand Up @@ -79,7 +84,7 @@ getLicense: (spcString, contentId, licenseUrl, loadedLicenseUrl) => {

### `contentId`

<PlatformsList types={['iOS']} />
<PlatformsList types={['iOS', 'visionOS']} />

Type: string\
Default: undefined
Expand All @@ -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
Expand All @@ -112,7 +117,7 @@ drm={{

### `licenseServer`

<PlatformsList types={['Android', 'iOS']} />
<PlatformsList types={['Android', 'iOS', 'visionOS']} />

Type: string\
Default: false
Expand All @@ -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

Expand Down
10 changes: 5 additions & 5 deletions examples/bare/src/DRMExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 -------------
Expand Down

0 comments on commit f850b7a

Please sign in to comment.