diff --git a/src/parser.js b/src/parser.js index a922f74..eebe9ba 100644 --- a/src/parser.js +++ b/src/parser.js @@ -263,6 +263,17 @@ export default class Parser extends Stream { return; } + if (entry.attributes.KEYFORMAT === 'com.microsoft.playready') { + this.manifest.contentProtection = this.manifest.contentProtection || {}; + + // TODO: add full support for this. + this.manifest.contentProtection['com.microsoft.playready'] = { + uri: entry.attributes.URI + }; + + return; + } + // check if the content is encrypted for Widevine // Widevine/HLS spec: https://storage.googleapis.com/wvdocs/Widevine_DRM_HLS.pdf if (entry.attributes.KEYFORMAT === widevineUuid) { diff --git a/test/parser.test.js b/test/parser.test.js index 6b35bf8..ab73ed0 100644 --- a/test/parser.test.js +++ b/test/parser.test.js @@ -833,7 +833,7 @@ QUnit.module('m3u8s', function(hooks) { ); }); - QUnit.test('Can understand widevine/safari drm ext-x-key', function(assert) { + QUnit.test('Can understand widevine/fairplay/playready drm ext-x-key', function(assert) { this.parser.push([ '#EXT-X-VERSION:3', '#EXT-X-MEDIA-SEQUENCE:0', @@ -843,6 +843,7 @@ QUnit.module('m3u8s', function(hooks) { '#EXT-X-SERVER-CONTROL:foo=bar', '#EXT-X-KEY:METHOD=SAMPLE-AES,URI="data:text/plain;base64,foo",KEYID=0x555777,IV=1234567890abcdef1234567890abcdef,KEYFORMATVERSIONS="1",KEYFORMAT="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"', '#EXT-X-KEY:METHOD=SAMPLE-AES,URI="skd://foo",KEYFORMATVERSIONS="1",KEYFORMAT="com.apple.streamingkeydelivery"', + '#EXT-X-KEY:METHOD=SAMPLE-AES,URI="http://example.com",KEYFORMATVERSIONS="1",KEYFORMAT="com.microsoft.playready"', '#EXTINF:10,', 'media-00001.ts', '#EXT-X-ENDLIST' @@ -851,7 +852,7 @@ QUnit.module('m3u8s', function(hooks) { assert.deepEqual( Object.keys(this.parser.manifest.contentProtection), - ['com.widevine.alpha', 'com.apple.fps.1_0'], + ['com.widevine.alpha', 'com.apple.fps.1_0', 'com.microsoft.playready'], 'info as expected' ); });