From c6c39dfafc80ab2b02e4dd91c7451227e95bb0a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Fri, 26 Apr 2024 06:49:15 +0200 Subject: [PATCH] feat: Add encryptionScheme to shaka.extern.DrmInfo (#6480) Related to https://github.com/shaka-project/shaka-player/issues/1419 --- externs/shaka/manifest.js | 4 ++ lib/dash/content_protection.js | 40 ++++++++++++++----- lib/hls/hls_parser.js | 24 +++++++++-- lib/media/drm_engine.js | 30 ++++++++++++-- lib/mss/content_protection.js | 3 +- lib/util/manifest_parser_utils.js | 10 +++-- .../dash_parser_content_protection_unit.js | 38 +++++++++++++++++- test/hls/hls_parser_unit.js | 16 ++++++++ test/media/drm_engine_unit.js | 1 + test/offline/manifest_convert_unit.js | 1 + test/offline/storage_integration.js | 1 + test/test/util/manifest_generator.js | 2 + 12 files changed, 148 insertions(+), 22 deletions(-) diff --git a/externs/shaka/manifest.js b/externs/shaka/manifest.js index ee45b5d03b..6e17d63308 100644 --- a/externs/shaka/manifest.js +++ b/externs/shaka/manifest.js @@ -181,6 +181,7 @@ shaka.extern.ServiceDescription; /** * @typedef {{ * keySystem: string, + * encryptionScheme: string, * licenseServerUri: string, * distinctiveIdentifierRequired: boolean, * persistentStateRequired: boolean, @@ -199,6 +200,9 @@ shaka.extern.ServiceDescription; * @property {string} keySystem * Required.
* The key system, e.g., "com.widevine.alpha". + * @property {string} encryptionScheme + * Required.
+ * The encryption scheme, e.g., "cenc", "cbcs", "cbcs-1-9". * @property {string} licenseServerUri * Filled in by DRM config if missing.
* The license server URI. diff --git a/lib/dash/content_protection.js b/lib/dash/content_protection.js index 38be75da7f..05c6a6eafa 100644 --- a/lib/dash/content_protection.js +++ b/lib/dash/content_protection.js @@ -47,6 +47,8 @@ shaka.dash.ContentProtection = class { // Remove any possible null value (elements may have no key ids). keyIds.delete(null); + let encryptionScheme = 'cenc'; + if (keyIds.size > 1) { throw new shaka.util.Error( shaka.util.Error.Severity.CRITICAL, @@ -70,6 +72,14 @@ shaka.dash.ContentProtection = class { aes128Info = ContentProtection.parseAes128_(aes128Elements[0]); } + const mp4ProtectionParsed = parsed.find((elem) => { + return elem.schemeUri == ContentProtection.MP4Protection_; + }); + + if (mp4ProtectionParsed && mp4ProtectionParsed.encryptionScheme) { + encryptionScheme = mp4ProtectionParsed.encryptionScheme; + } + // Find the default key ID and init data. Create a new array of all the // non-CENC elements. parsedNonCenc = parsed.filter((elem) => { @@ -84,13 +94,14 @@ shaka.dash.ContentProtection = class { }); if (parsedNonCenc.length) { - drmInfos = ContentProtection.convertElements_( - defaultInit, parsedNonCenc, keySystemsByURI, keyIds); + drmInfos = ContentProtection.convertElements_(defaultInit, + encryptionScheme, parsedNonCenc, keySystemsByURI, keyIds); // If there are no drmInfos after parsing, then add a dummy entry. // This may be removed in parseKeyIds. if (drmInfos.length == 0) { - drmInfos = [ManifestParserUtils.createDrmInfo('', defaultInit)]; + drmInfos = [ManifestParserUtils.createDrmInfo( + '', encryptionScheme, defaultInit)]; } } } @@ -106,8 +117,8 @@ shaka.dash.ContentProtection = class { // put clearkey in this list. Otherwise, it may be triggered when // a real key system should be used instead. if (keySystem != 'org.w3.clearkey') { - const info = - ManifestParserUtils.createDrmInfo(keySystem, defaultInit); + const info = ManifestParserUtils.createDrmInfo( + keySystem, encryptionScheme, defaultInit); drmInfos.push(info); } } @@ -467,13 +478,15 @@ shaka.dash.ContentProtection = class { * Creates DrmInfo objects from the given element. * * @param {Array.} defaultInit + * @param {string} encryptionScheme * @param {!Array.} elements * @param {!Object.} keySystemsByURI * @param {!Set.} keyIds * @return {!Array.} * @private */ - static convertElements_(defaultInit, elements, keySystemsByURI, keyIds) { + static convertElements_(defaultInit, encryptionScheme, elements, + keySystemsByURI, keyIds) { const ContentProtection = shaka.dash.ContentProtection; const ManifestParserUtils = shaka.util.ManifestParserUtils; const licenseUrlParsers = ContentProtection.licenseUrlParsers_; @@ -497,7 +510,8 @@ shaka.dash.ContentProtection = class { } const initData = element.init || defaultInit || proInitData || clearKeyInitData; - const info = ManifestParserUtils.createDrmInfo(keySystem, initData); + const info = ManifestParserUtils.createDrmInfo( + keySystem, encryptionScheme, initData); const licenseParser = licenseUrlParsers.get(keySystem); if (licenseParser) { info.licenseServerUri = licenseParser(element); @@ -551,6 +565,8 @@ shaka.dash.ContentProtection = class { const psshs = TXml.findChildrenNS(elem, NS, 'pssh') .map(TXml.getContents); + const encryptionScheme = elem.attributes['value']; + if (!schemeUri) { shaka.log.error('Missing required schemeIdUri attribute on', 'ContentProtection element', elem); @@ -588,9 +604,10 @@ shaka.dash.ContentProtection = class { return { node: elem, - schemeUri: schemeUri, - keyId: keyId, + schemeUri, + keyId, init: (init.length > 0 ? init : null), + encryptionScheme, }; } @@ -748,7 +765,8 @@ shaka.dash.ContentProtection.Aes128Info; * node: !shaka.extern.xml.Node, * schemeUri: string, * keyId: ?string, - * init: Array. + * init: Array., + * encryptionScheme: ?string * }} * * @description @@ -763,6 +781,8 @@ shaka.dash.ContentProtection.Aes128Info; * @property {Array.} init * The init data, if present. If there is no init data, it will be null. If * this is non-null, there is at least one element. + * @property {?string} encryptionScheme + * The encryption scheme, if present. */ shaka.dash.ContentProtection.Element; diff --git a/lib/hls/hls_parser.js b/lib/hls/hls_parser.js index 5120179a87..98ebef731e 100644 --- a/lib/hls/hls_parser.js +++ b/lib/hls/hls_parser.js @@ -4173,7 +4173,7 @@ shaka.hls.HlsParser = class { * with the correct keySystem and initDataType */ const drmInfo = shaka.util.ManifestParserUtils.createDrmInfo( - 'com.apple.fps', [ + 'com.apple.fps', /* encryptionScheme= */ 'cbcs-1-9', [ {initDataType: 'sinf', initData: new Uint8Array(0), keyId: null}, ]); @@ -4194,13 +4194,18 @@ shaka.hls.HlsParser = class { return null; } + let encryptionScheme = 'cenc'; + if (method == 'SAMPLE-AES') { + encryptionScheme = 'cbcs'; + } + const uri = drmTag.getRequiredAttrValue('URI'); const parsedData = shaka.net.DataUriPlugin.parseRaw(uri); // The data encoded in the URI is a PSSH box to be used as init data. const pssh = shaka.util.BufferUtils.toUint8(parsedData.data); const drmInfo = shaka.util.ManifestParserUtils.createDrmInfo( - 'com.widevine.alpha', [ + 'com.widevine.alpha', encryptionScheme, [ {initDataType: 'cenc', initData: pssh}, ]); @@ -4232,6 +4237,11 @@ shaka.hls.HlsParser = class { return null; } + let encryptionScheme = 'cenc'; + if (method == 'SAMPLE-AES') { + encryptionScheme = 'cbcs'; + } + const uri = drmTag.getRequiredAttrValue('URI'); const parsedData = shaka.net.DataUriPlugin.parseRaw(uri); @@ -4247,7 +4257,7 @@ shaka.hls.HlsParser = class { const pssh = shaka.util.Pssh.createPssh(data, systemId, keyIds, psshVersion); const drmInfo = shaka.util.ManifestParserUtils.createDrmInfo( - 'com.microsoft.playready', [ + 'com.microsoft.playready', encryptionScheme, [ {initDataType: 'cenc', initData: pssh}, ]); @@ -4350,7 +4360,13 @@ shaka.hls.HlsParser = class { const clearkeys = new Map(); clearkeys.set(keyId, key); - return shaka.util.ManifestParserUtils.createDrmInfoFromClearKeys(clearkeys); + let encryptionScheme = 'cenc'; + if (method == 'SAMPLE-AES') { + encryptionScheme = 'cbcs'; + } + + return shaka.util.ManifestParserUtils.createDrmInfoFromClearKeys( + clearkeys, encryptionScheme); } }; diff --git a/lib/media/drm_engine.js b/lib/media/drm_engine.js index 3c6e3e6295..db9abf6e00 100644 --- a/lib/media/drm_engine.js +++ b/lib/media/drm_engine.js @@ -2168,6 +2168,9 @@ shaka.media.DrmEngine = class { * @private */ createDrmInfoByInfos_(keySystem, drmInfos) { + /** @type {!Array.} */ + const encryptionSchemes = []; + /** @type {!Array.} */ const licenseServers = []; @@ -2184,9 +2187,14 @@ shaka.media.DrmEngine = class { const keyIds = new Set(); shaka.media.DrmEngine.processDrmInfos_( - drmInfos, licenseServers, serverCerts, + drmInfos, encryptionSchemes, licenseServers, serverCerts, serverCertificateUris, initDatas, keyIds); + if (encryptionSchemes.length > 1) { + shaka.log.warning('Multiple unique encryption schemes found! ' + + 'Only the first will be used.'); + } + if (serverCerts.length > 1) { shaka.log.warning('Multiple unique server certificates found! ' + 'Only the first will be used.'); @@ -2208,6 +2216,7 @@ shaka.media.DrmEngine = class { /** @type {shaka.extern.DrmInfo} */ const res = { keySystem, + encryptionScheme: encryptionSchemes[0], licenseServerUri: licenseServers[0], distinctiveIdentifierRequired: drmInfos[0].distinctiveIdentifierRequired, persistentStateRequired: drmInfos[0].persistentStateRequired, @@ -2244,6 +2253,9 @@ shaka.media.DrmEngine = class { * @private */ static createDrmInfoByConfigs_(keySystem, config) { + /** @type {!Array.} */ + const encryptionSchemes = []; + /** @type {!Array.} */ const licenseServers = []; @@ -2261,9 +2273,14 @@ shaka.media.DrmEngine = class { // TODO: refactor, don't stick drmInfos onto MediaKeySystemConfiguration shaka.media.DrmEngine.processDrmInfos_( - config['drmInfos'], licenseServers, serverCerts, + config['drmInfos'], encryptionSchemes, licenseServers, serverCerts, serverCertificateUris, initDatas, keyIds); + if (encryptionSchemes.length > 1) { + shaka.log.warning('Multiple unique encryption schemes found! ' + + 'Only the first will be used.'); + } + if (serverCerts.length > 1) { shaka.log.warning('Multiple unique server certificates found! ' + 'Only the first will be used.'); @@ -2288,6 +2305,7 @@ shaka.media.DrmEngine = class { const distinctiveIdentifier = config.distinctiveIdentifier; return { keySystem, + encryptionScheme: encryptionSchemes[0], licenseServerUri: licenseServers[0], distinctiveIdentifierRequired: (distinctiveIdentifier == 'required'), persistentStateRequired: (config.persistentState == 'required'), @@ -2307,6 +2325,7 @@ shaka.media.DrmEngine = class { * * @param {!Array.} drmInfos * @param {!Array.} licenseServers + * @param {!Array.} encryptionSchemes * @param {!Array.} serverCerts * @param {!Array.} serverCertificateUris * @param {!Array.} initDatas @@ -2314,7 +2333,7 @@ shaka.media.DrmEngine = class { * @private */ static processDrmInfos_( - drmInfos, licenseServers, serverCerts, + drmInfos, encryptionSchemes, licenseServers, serverCerts, serverCertificateUris, initDatas, keyIds) { /** @type {function(shaka.extern.InitDataOverride, * shaka.extern.InitDataOverride):boolean} */ @@ -2332,6 +2351,11 @@ shaka.media.DrmEngine = class { const clearKeyLicenseServers = []; for (const drmInfo of drmInfos) { + // Build an array of unique encryption schemes. + if (!encryptionSchemes.includes(drmInfo.encryptionScheme)) { + encryptionSchemes.push(drmInfo.encryptionScheme); + } + // Build an array of unique license servers. if (drmInfo.keySystem == 'org.w3.clearkey' && drmInfo.licenseServerUri.startsWith(clearkeyDataStart)) { diff --git a/lib/mss/content_protection.js b/lib/mss/content_protection.js index a7e3edd67b..a9f5a119e9 100644 --- a/lib/mss/content_protection.js +++ b/lib/mss/content_protection.js @@ -296,7 +296,8 @@ shaka.mss.ContentProtection = class { const initData = ContentProtection.getInitDataFromPro_( element, systemID, KID); - const info = ManifestParserUtils.createDrmInfo(keySystem, initData); + const info = ManifestParserUtils.createDrmInfo( + keySystem, /* encryptionScheme= */ 'cenc', initData); if (KID) { info.keyIds.add(KID); } diff --git a/lib/util/manifest_parser_utils.js b/lib/util/manifest_parser_utils.js index 41321e509a..f3dffabb20 100644 --- a/lib/util/manifest_parser_utils.js +++ b/lib/util/manifest_parser_utils.js @@ -59,12 +59,14 @@ shaka.util.ManifestParserUtils = class { * Creates a DrmInfo object from the given info. * * @param {string} keySystem + * @param {string} encryptionScheme * @param {Array.} initData * @return {shaka.extern.DrmInfo} */ - static createDrmInfo(keySystem, initData) { + static createDrmInfo(keySystem, encryptionScheme, initData) { return { - keySystem: keySystem, + keySystem, + encryptionScheme, licenseServerUri: '', distinctiveIdentifierRequired: false, persistentStateRequired: false, @@ -82,9 +84,10 @@ shaka.util.ManifestParserUtils = class { * Creates a DrmInfo object from ClearKeys. * * @param {!Map.} clearKeys + * @param {string=} encryptionScheme * @return {shaka.extern.DrmInfo} */ - static createDrmInfoFromClearKeys(clearKeys) { + static createDrmInfoFromClearKeys(clearKeys, encryptionScheme = 'cenc') { const StringUtils = shaka.util.StringUtils; const Uint8ArrayUtils = shaka.util.Uint8ArrayUtils; const keys = []; @@ -126,6 +129,7 @@ shaka.util.ManifestParserUtils = class { return { keySystem: 'org.w3.clearkey', + encryptionScheme, licenseServerUri: 'data:application/json;base64,' + window.btoa(license), distinctiveIdentifierRequired: false, persistentStateRequired: false, diff --git a/test/dash/dash_parser_content_protection_unit.js b/test/dash/dash_parser_content_protection_unit.js index 202f09de18..62492b15a6 100644 --- a/test/dash/dash_parser_content_protection_unit.js +++ b/test/dash/dash_parser_content_protection_unit.js @@ -159,11 +159,14 @@ describe('DashParser ContentProtection', () => { * @param {string} keySystem * @param {!Array.=} keyIds * @param {!Array.=} initData + * @param {string=} encryptionScheme * @return {Object} A DrmInfo-like object. */ - function buildDrmInfo(keySystem, keyIds = [], initData = []) { + function buildDrmInfo(keySystem, keyIds = [], initData = [], + encryptionScheme = 'cenc') { return jasmine.objectContaining({ keySystem, + encryptionScheme, keyIds: new Set(keyIds), initData, }); @@ -397,6 +400,25 @@ describe('DashParser ContentProtection', () => { await testDashParser(source, expected); }); + it('assumes all known key systems for generic CBCS', async () => { + const source = buildManifestText([ + // AdaptationSet lines + '', + ], [], []); + // The order does not matter here, so use arrayContaining. + // NOTE: the buildDrmInfo calls here specify no init data + const drmInfos = jasmine.arrayContaining([ + buildDrmInfo('com.widevine.alpha', [], [], 'cbcs'), + buildDrmInfo('com.microsoft.playready', [], [], 'cbcs'), + ]); + const expected = buildExpectedManifest( + /** @type {!Array.} */(drmInfos), + [], // key IDs + ); + await testDashParser(source, expected); + }); + it('assumes all known key systems when ignoreDrmInfo is set', async () => { const source = buildManifestText([ // AdaptationSet lines @@ -764,6 +786,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml([ '', ' ', @@ -779,6 +802,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml([ '', ' ', @@ -794,6 +818,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml([ '', ' www.example.com', @@ -809,6 +834,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml([ '', ' ', @@ -824,6 +850,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml(''), }; const actual = ContentProtection.getWidevineLicenseUrl(input); @@ -837,6 +864,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml([ '', ' { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml([ '', ' ', @@ -868,6 +897,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml([ '', ' www.example.com', @@ -883,6 +913,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml([ '', ' ', @@ -898,6 +929,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml(''), }; const actual = ContentProtection.getClearKeyLicenseUrl(input); @@ -935,6 +967,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml([ '', @@ -951,6 +984,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml([ '', ' www.example.com', @@ -966,6 +1000,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml([ '', ' ', @@ -981,6 +1016,7 @@ describe('DashParser ContentProtection', () => { init: null, keyId: null, schemeUri: '', + encryptionScheme: null, node: strToXml(''), }; const actual = ContentProtection.getPlayReadyLicenseUrl(input); diff --git a/test/hls/hls_parser_unit.js b/test/hls/hls_parser_unit.js index f25d469305..aae30f0185 100644 --- a/test/hls/hls_parser_unit.js +++ b/test/hls/hls_parser_unit.js @@ -3547,6 +3547,7 @@ describe('HlsParser', () => { stream.addDrmInfo('com.widevine.alpha', (drmInfo) => { drmInfo.addCencInitData(initDataBase64); drmInfo.keyIds.add(keyId); + drmInfo.encryptionScheme = 'cenc'; }); }); }); @@ -3589,6 +3590,7 @@ describe('HlsParser', () => { stream.encrypted = true; stream.addDrmInfo('com.microsoft.playready', (drmInfo) => { drmInfo.addCencInitData(initDataBase64); + drmInfo.encryptionScheme = 'cenc'; }); }); }); @@ -3628,6 +3630,7 @@ describe('HlsParser', () => { stream.encrypted = true; stream.addDrmInfo('com.apple.fps', (drmInfo) => { drmInfo.addInitData('sinf', new Uint8Array(0)); + drmInfo.encryptionScheme = 'cbcs-1-9'; }); }); }); @@ -3673,6 +3676,7 @@ describe('HlsParser', () => { 'IiwiayI6IlVHbzJhRVpuZERWcFJscDBaa0pNVGpadmNUaEZaejA5In1dfQ=='; drmInfo.keyIds.add(keyId); drmInfo.addKeyIdsData(initDataBase64); + drmInfo.encryptionScheme = 'cenc'; }); }); }); @@ -3719,6 +3723,7 @@ describe('HlsParser', () => { 'IiwiayI6IlVHbzJhRVpuZERWcFJscDBaa0pNVGpadmNUaEZaejA5In1dfQ=='; drmInfo.keyIds.add(keyId); drmInfo.addKeyIdsData(initDataBase64); + drmInfo.encryptionScheme = 'cenc'; }); }); }); @@ -3766,6 +3771,7 @@ describe('HlsParser', () => { 'IiwiayI6IlBqNmhGZ3Q1aUZadGZCTE42b3E4RWcifV19'; drmInfo.keyIds.add(keyId); drmInfo.addKeyIdsData(initDataBase64); + drmInfo.encryptionScheme = 'cenc'; }); }); }); @@ -3806,6 +3812,7 @@ describe('HlsParser', () => { stream.addDrmInfo('com.widevine.alpha', (drmInfo) => { drmInfo.addCencInitData(initDataBase64); drmInfo.keyIds.add(keyId); + drmInfo.encryptionScheme = 'cenc'; }); }); }); @@ -3814,6 +3821,7 @@ describe('HlsParser', () => { stream.addDrmInfo('com.widevine.alpha', (drmInfo) => { drmInfo.addCencInitData(initDataBase64); drmInfo.keyIds.add(keyId); + drmInfo.encryptionScheme = 'cenc'; }); }); }); @@ -3850,6 +3858,7 @@ describe('HlsParser', () => { variant.addPartialStream(ContentType.VIDEO, (stream) => { stream.addDrmInfo('com.microsoft.playready', (drmInfo) => { drmInfo.addCencInitData(initDataBase64); + drmInfo.encryptionScheme = 'cenc'; }); }); }); @@ -3857,6 +3866,7 @@ describe('HlsParser', () => { variant.addPartialStream(ContentType.VIDEO, (stream) => { stream.addDrmInfo('com.microsoft.playready', (drmInfo) => { drmInfo.addCencInitData(initDataBase64); + drmInfo.encryptionScheme = 'cenc'; }); }); }); @@ -3890,6 +3900,7 @@ describe('HlsParser', () => { variant.addPartialStream(ContentType.VIDEO, (stream) => { stream.addDrmInfo('com.apple.fps', (drmInfo) => { drmInfo.addInitData('sinf', new Uint8Array(0)); + drmInfo.encryptionScheme = 'cbcs-1-9'; }); }); }); @@ -3897,6 +3908,7 @@ describe('HlsParser', () => { variant.addPartialStream(ContentType.VIDEO, (stream) => { stream.addDrmInfo('com.apple.fps', (drmInfo) => { drmInfo.addInitData('sinf', new Uint8Array(0)); + drmInfo.encryptionScheme = 'cbcs-1-9'; }); }); }); @@ -3939,6 +3951,7 @@ describe('HlsParser', () => { drmInfo.licenseServerUri = licenseServerUri; drmInfo.keyIds.add(keyId); drmInfo.addKeyIdsData(initDataBase64); + drmInfo.encryptionScheme = 'cenc'; }); }); }); @@ -3948,6 +3961,7 @@ describe('HlsParser', () => { drmInfo.licenseServerUri = licenseServerUri; drmInfo.keyIds.add(keyId); drmInfo.addKeyIdsData(initDataBase64); + drmInfo.encryptionScheme = 'cenc'; }); }); }); @@ -3991,6 +4005,7 @@ describe('HlsParser', () => { drmInfo.licenseServerUri = licenseServerUri; drmInfo.keyIds.add(keyId); drmInfo.addKeyIdsData(initDataBase64); + drmInfo.encryptionScheme = 'cenc'; }); }); }); @@ -4000,6 +4015,7 @@ describe('HlsParser', () => { drmInfo.licenseServerUri = licenseServerUri; drmInfo.keyIds.add(keyId); drmInfo.addKeyIdsData(initDataBase64); + drmInfo.encryptionScheme = 'cenc'; }); }); }); diff --git a/test/media/drm_engine_unit.js b/test/media/drm_engine_unit.js index c51f7016ce..ab4a68cdc8 100644 --- a/test/media/drm_engine_unit.js +++ b/test/media/drm_engine_unit.js @@ -2296,6 +2296,7 @@ describe('DrmEngine', () => { const drmInfo = drmEngine.getDrmInfo(); expect(drmInfo).toEqual({ keySystem: 'drm.abc', + encryptionScheme: '', licenseServerUri: 'http://abc.drm/license', distinctiveIdentifierRequired: true, persistentStateRequired: true, diff --git a/test/offline/manifest_convert_unit.js b/test/offline/manifest_convert_unit.js index 4f5915eede..1b05b5f4aa 100644 --- a/test/offline/manifest_convert_unit.js +++ b/test/offline/manifest_convert_unit.js @@ -87,6 +87,7 @@ describe('ManifestConverter', () => { sessionIds: [1, 2, 3, 4], drmInfo: { keySystem: 'com.foo.bar', + encryptionScheme: 'foo', licenseServerUri: 'http://example.com/drm', distinctiveIdentifierRequired: true, persistentStateRequired: true, diff --git a/test/offline/storage_integration.js b/test/offline/storage_integration.js index 63a65c0b75..d5cdaa270d 100644 --- a/test/offline/storage_integration.js +++ b/test/offline/storage_integration.js @@ -1696,6 +1696,7 @@ filterDescribe('Storage', storageSupport, () => { function makeDrmInfo() { const drmInfo = { keySystem: 'com.example.abc', + encryptionScheme: 'example', licenseServerUri: 'http://example.com', persistentStateRequired: true, distinctiveIdentifierRequired: false, diff --git a/test/test/util/manifest_generator.js b/test/test/util/manifest_generator.js index d2990a1a1b..132fbc5437 100644 --- a/test/test/util/manifest_generator.js +++ b/test/test/util/manifest_generator.js @@ -391,6 +391,8 @@ shaka.test.ManifestGenerator.DrmInfo = class { /** @type {string} */ this.keySystem = keySystem; /** @type {string} */ + this.encryptionScheme = ''; + /** @type {string} */ this.licenseServerUri = ''; /** @type {boolean} */ this.distinctiveIdentifierRequired = false;