Skip to content

Commit 2bd4441

Browse files
Merge pull request #24 from relivecc/react-native-video-5.1.1
Pull react-native-video 5.1.1
2 parents b6f95e8 + 327dcfb commit 2bd4441

58 files changed

Lines changed: 2313 additions & 2048 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"extends": "airbnb",
3-
"parser": "babel-eslint"
2+
"extends": "@react-native-community",
43
}

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"requirePragma": true,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"bracketSpacing": false,
6+
"jsxBracketSameLine": true,
7+
"parser": "flow"
8+
}

CHANGELOG.md

Lines changed: 160 additions & 98 deletions
Large diffs are not rendered by default.

DRM.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# DRM
2+
3+
## Provide DRM data (only tested with http/https assets)
4+
5+
You can provide some configuration to allow DRM playback.
6+
This feature will disable the use of `TextureView` on Android.
7+
8+
DRM object allows this members:
9+
10+
| Property | Type | Default | Platform | Description |
11+
| --- | --- | --- | --- | --- |
12+
| [`type`](#type) | DRMType | undefined | iOS/Android | Specifies which type of DRM you are going to use, DRMType is an enum exposed on the JS module ('fairplay', 'playready', ...) |
13+
| [`licenseServer`](#licenseserver) | string | undefined | iOS/Android | Specifies the license server URL |
14+
| [`headers`](#headers) | Object | undefined | iOS/Android | Specifies the headers send to the license server URL on license acquisition |
15+
| [`contentId`](#contentid) | string | undefined | iOS | Specify the content id of the stream, otherwise it will take the host value from `loadingRequest.request.URL.host` (f.e: `skd://testAsset` -> will take `testAsset`) |
16+
| [`certificateUrl`](#certificateurl) | string | undefined | iOS | Specifies the url to obtain your ios certificate for fairplay, Url to the .cer file |
17+
| [`base64Certificate`](#base64certificate) | bool | false | iOS | Specifies whether or not the certificate returned by the `certificateUrl` is on base64 |
18+
| [`getLicense`](#getlicense)| function | undefined | iOS | Rather than setting the `licenseServer` url to get the license, you can manually get the license on the JS part, and send the result to the native part to configure FairplayDRM for the stream |
19+
20+
### `base64Certificate`
21+
22+
Whether or not the certificate url returns it on base64.
23+
24+
Platforms: iOS
25+
26+
### `certificateUrl`
27+
28+
URL to fetch a valid certificate for FairPlay.
29+
30+
Platforms: iOS
31+
32+
### `getLicense`
33+
34+
`licenseServer` and `headers` will be ignored. You will obtain as argument the `SPC` (as ASCII string, you will probably need to convert it to base 64) obtained from your `contentId` + the provided certificate via `[loadingRequest streamingContentKeyRequestDataForApp:certificateData contentIdentifier:contentIdData options:nil error:&spcError];`.
35+
You should return on this method a `CKC` in Base64, either by just returning it or returning a `Promise` that resolves with the `CKC`.
36+
37+
With this prop you can override the license acquisition flow, as an example:
38+
39+
```js
40+
getLicense: (spcString) => {
41+
const base64spc = Base64.encode(spcString);
42+
const formData = new FormData();
43+
formData.append('spc', base64spc);
44+
return fetch(`https://license.pallycon.com/ri/licenseManager.do`, {
45+
method: 'POST',
46+
headers: {
47+
'pallycon-customdata-v2': 'd2VpcmRiYXNlNjRzdHJpbmcgOlAgRGFuaWVsIE1hcmnxbyB3YXMgaGVyZQ==',
48+
'Content-Type': 'application/x-www-form-urlencoded',
49+
},
50+
body: formData
51+
}).then(response => response.text()).then((response) => {
52+
return response;
53+
}).catch((error) => {
54+
console.error('Error', error);
55+
});
56+
}
57+
```
58+
59+
Platforms: iOS
60+
61+
### `headers`
62+
63+
You can customize headers send to the licenseServer.
64+
65+
Example:
66+
67+
```js
68+
source={{
69+
uri: 'https://media.axprod.net/TestVectors/v7-MultiDRM-SingleKey/Manifest_1080p.mpd',
70+
}}
71+
drm={{
72+
type: DRMType.WIDEVINE,
73+
licenseServer: 'https://drm-widevine-licensing.axtest.net/AcquireLicense',
74+
headers: {
75+
'X-AxDRM-Message': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiYjMzNjRlYjUtNTFmNi00YWUzLThjOTgtMzNjZWQ1ZTMxYzc4IiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImZpcnN0X3BsYXlfZXhwaXJhdGlvbiI6NjAsInBsYXlyZWFkeSI6eyJyZWFsX3RpbWVfZXhwaXJhdGlvbiI6dHJ1ZX0sImtleXMiOlt7ImlkIjoiOWViNDA1MGQtZTQ0Yi00ODAyLTkzMmUtMjdkNzUwODNlMjY2IiwiZW5jcnlwdGVkX2tleSI6ImxLM09qSExZVzI0Y3Iya3RSNzRmbnc9PSJ9XX19.FAbIiPxX8BHi9RwfzD7Yn-wugU19ghrkBFKsaCPrZmU'
76+
},
77+
}}
78+
```
79+
80+
### `licenseServer`
81+
82+
The URL pointing to the licenseServer that will provide the authorization to play the protected stream.
83+
84+
### `type`
85+
86+
You can specify the DRM type, either by string or using the exported DRMType enum.
87+
Valid values are, for Android: DRMType.WIDEVINE / DRMType.PLAYREADY / DRMType.CLEARKEY.
88+
for iOS: DRMType.FAIRPLAY
89+
90+
## Common Usage Scenarios
91+
92+
### Send cookies to license server
93+
94+
You can send Cookies to the license server via `headers` prop. Example:
95+
96+
```js
97+
drm: {
98+
type: DRMType.WIDEVINE
99+
licenseServer: 'https://drm-widevine-licensing.axtest.net/AcquireLicense',
100+
headers: {
101+
'Cookie': 'PHPSESSID=etcetc; csrftoken=mytoken; _gat=1; foo=bar'
102+
},
103+
}
104+
```
105+
106+
### Custom License Acquisition (only iOS for now)
107+
108+
```js
109+
drm: {
110+
type: DRMType.FAIRPLAY,
111+
getLicense: (spcString) => {
112+
const base64spc = Base64.encode(spcString);
113+
return fetch('YOUR LICENSE SERVER HERE', {
114+
method: 'POST',
115+
headers: {
116+
'Content-Type': 'application/json',
117+
Accept: 'application/json',
118+
},
119+
body: JSON.stringify({
120+
getFairplayLicense: {
121+
foo: 'bar',
122+
spcMessage: base64spc,
123+
}
124+
})
125+
})
126+
.then(response => response.json())
127+
.then((response) => {
128+
if (response && response.getFairplayLicenseResponse
129+
&& response.getFairplayLicenseResponse.ckcResponse) {
130+
return response.getFairplayLicenseResponse.ckcResponse;
131+
}
132+
throw new Error('No correct response');
133+
})
134+
.catch((error) => {
135+
console.error('CKC error', error);
136+
});
137+
}
138+
}
139+
```

DRMType.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
WIDEVINE: 'widevine',
3+
PLAYREADY: 'playready',
4+
CLEARKEY: 'clearkey',
5+
FAIRPLAY: 'fairplay'
6+
};

FilterType.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ export default {
1414
PROCESS: 'CIPhotoEffectProcess',
1515
TONAL: 'CIPhotoEffectTonal',
1616
TRANSFER: 'CIPhotoEffectTransfer',
17-
SEPIA: 'CISepiaTone'
17+
SEPIA: 'CISepiaTone',
1818
};

0 commit comments

Comments
 (0)