Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add modern EME support for FairPlay #3776

Merged
merged 30 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2710251
feat: add support for HLS EME com.apple.fps keySystem
valotvince Nov 29, 2021
6be7725
revert
valotvince Nov 30, 2021
f20bd58
enhance hls parser and add a unit test
valotvince Dec 1, 2021
70133e6
add rule on setting media keys if polyfilled
valotvince Dec 1, 2021
4e9a3e0
update docs
valotvince Dec 2, 2021
3b43e34
detect sinf data from legacy media keys implementation
valotvince Dec 15, 2021
421b0b8
prevent playback when using TS w/ MSE or MSE w/ legacy Apple Media Keys
valotvince Dec 20, 2021
7ed4c43
fixup doc
valotvince Dec 20, 2021
c37fb46
add error test in hls parser
valotvince Dec 20, 2021
bac1ca8
fixup drm engine tests
valotvince Dec 21, 2021
06d8482
remove useless test
valotvince Dec 23, 2021
c7ea708
rename platform polyfill detect will => should
valotvince Jan 21, 2022
1f60cb0
remove eslint disable on drm engine
valotvince Jan 21, 2022
854d6eb
documentation adjustements
valotvince Jan 21, 2022
e03cae7
fixes conccurence on attachMediaKeys "gets a license and can play enc…
valotvince Jan 21, 2022
d6e8aee
fix offline session loading
valotvince Jan 21, 2022
e9be15d
fixup clearkey playback
valotvince Jan 21, 2022
1f659a7
prevent clearkey test to run on Safari (like before)
valotvince Jan 24, 2022
df1cee7
revert comment
valotvince Jan 25, 2022
1ca5399
add hint to webkit bug tracker for clearkey
valotvince Jan 25, 2022
acf47d9
change how we detect polyfill MediaKeys
valotvince Jan 25, 2022
a3b9ec7
enhance comment on useNativeHlsOnSafari
valotvince Jan 25, 2022
f6fbcf1
remove useless method in platform util
valotvince Jan 25, 2022
ed532c5
make fps work with dash
valotvince Jan 26, 2022
4bcd860
remove reference to HLS
valotvince Jan 26, 2022
971987e
fixup doc
valotvince Jan 26, 2022
7f018a8
fixup test with a new key system uid
valotvince Jan 27, 2022
159ea32
fixup documentation
valotvince Jan 27, 2022
b1d78d8
rename nonEmptyInitData to manifestInitData
valotvince Feb 7, 2022
9d313ed
remove DASH-related code
valotvince Feb 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
enhance hls parser and add a unit test
  • Loading branch information
valotvince committed Feb 2, 2022
commit f20bd58af14b0d7ce31b14794aa939dad4b2f755
2 changes: 1 addition & 1 deletion lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2819,7 +2819,7 @@ shaka.hls.HlsParser = class {
*/
const drmInfo = shaka.util.ManifestParserUtils.createDrmInfo(
'com.apple.fps', [
{initDataType: 'sinf'},
{initDataType: 'sinf', initData: new Uint8Array(0)},
]);

return drmInfo;
Expand Down
4 changes: 2 additions & 2 deletions lib/media/drm_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,10 @@ shaka.media.DrmEngine = class {
* been seen yet, this will create a new session for it.
*
* @param {string} initDataType
* @param {Uint8Array} initData
* @param {!Uint8Array} initData
*/
newInitData(initDataType, initData) {
if (!initData) {
if (!initData.length) {
return;
}

Expand Down
36 changes: 36 additions & 0 deletions test/hls/hls_parser_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2231,6 +2231,42 @@ describe('HlsParser', () => {
await testHlsParser(master, media, manifest);
});

it('constructs DrmInfo for FairPlay', async () => {
const master = [
'#EXTM3U\n',
'#EXT-X-STREAM-INF:BANDWIDTH=200,CODECS="avc1",',
'RESOLUTION=960x540,FRAME-RATE=60\n',
'video\n',
].join('');

const media = [
'#EXTM3U\n',
'#EXT-X-TARGETDURATION:6\n',
'#EXT-X-PLAYLIST-TYPE:VOD\n',
'#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,',
'KEYFORMAT="com.apple.streamingkeydelivery",',
'URI="skd://f93d4e700d7ddde90529a27735d9e7cb",\n',
'#EXT-X-MAP:URI="init.mp4"\n',
'#EXTINF:5,\n',
'#EXT-X-BYTERANGE:121090@616\n',
'main.mp4',
].join('');

const manifest = shaka.test.ManifestGenerator.generate((manifest) => {
manifest.anyTimeline();
manifest.addPartialVariant((variant) => {
variant.addPartialStream(ContentType.VIDEO, (stream) => {
stream.encrypted = true;
stream.addDrmInfo('com.apple.fps', (drmInfo) => {
drmInfo.addInitData('sinf', new Uint8Array(0));
});
});
});
});

await testHlsParser(master, media, manifest);
});

it('falls back to mp4 if HEAD request fails', async () => {
const master = [
'#EXTM3U\n',
Expand Down
2 changes: 1 addition & 1 deletion test/test/util/manifest_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ shaka.test.ManifestGenerator.DrmInfo = class {
if (!this.initData) {
this.initData = [];
}
this.initData.push({initData: buffer, initDataType: type, keyId: null});
this.initData.push({initData: buffer, initDataType: type});
}

/**
Expand Down