diff --git a/samples/dash-if-reference-player/app/sources.json b/samples/dash-if-reference-player/app/sources.json index 0c26b09739..631abf51b2 100644 --- a/samples/dash-if-reference-player/app/sources.json +++ b/samples/dash-if-reference-player/app/sources.json @@ -289,7 +289,7 @@ "name": "LiveSIM Caminandes 02, Gran Dillama (25fps, 25gop, 2sec, multi MOOF/MDAT, 1080p, KID=1236) v2", "url": "http://refapp.hbbtv.org/livesim2/02_llamav2/manifest.mpd", "provider": "hbbtv" - }, + }, { "name": "Live Testcard - Multiple Languages, AVC Video", "url": "https://rdmedia.bbc.co.uk/testcard/simulcast/manifests/avc-full.mpd", @@ -452,11 +452,11 @@ "url": "https://dash.akamaized.net/dash264/CTA/imsc1/IT1-20171027_dash.mpd", "name": "IMSC1 Text Subtitles via sidecar file", "provider": "cta" - } + } ] }, { - "name": "DRM (modern)", + "name": "DRM", "submenu": [ { "name": "Multiperiod - ContentProtection Reference", @@ -1069,6 +1069,16 @@ } } }, + { + "name": "Livesim 2 ECCP with CBCS encryption and dashif:Laurl", + "url": "https://livesim2.dashif.org/livesim2/eccp_cbcs/testpic_2s/Manifest.mpd", + "provider": "dashif" + }, + { + "name": "Livesim 2 ECCP with CENC encryption and dashif:Laurl", + "url": "https://livesim2.dashif.org/livesim2/eccp_cenc/testpic_2s/Manifest.mpd", + "provider": "dashif" + }, { "name": "Microsoft AZURE MEDIA SERVICES ON DEMAND H264 AAC 4K CENC PLAYREADY 2.0", "url": "https://profficialsite.origin.mediaservices.windows.net/c51358ea-9a5e-4322-8951-897d640fdfd7/tearsofsteel_4k.ism/manifest(format=mpd-time-csf)", @@ -1133,144 +1143,6 @@ } ] }, - { - "name": "DRM Content (conservative/legacy)", - "submenu": [ - { - "name": "1080p with PlayReady and Widevine DRM, single key", - "url": "https://media.axprod.net/TestVectors/v6.1-MultiDRM/Manifest_1080p.mpd", - "protData": { - "com.widevine.alpha": { - "serverURL": "https://drm-widevine-licensing.axtest.net/AcquireLicense", - "httpRequestHeaders": { - "X-AxDRM-Message": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiNmU1YTFkMjYtMjc1Ny00N2Q3LTgwNDYtZWFhNWQxZDM0YjVhIn1dfX0.yF7PflOPv9qHnu3ZWJNZ12jgkqTabmwXbDWk_47tLNE" - }, - "httpTimeout": 5000, - "audioRobustness": "SW_SECURE_CRYPTO", - "videoRobustness": "SW_SECURE_DECODE" - }, - "com.microsoft.playready": { - "serverURL": "https://drm-playready-licensing.axtest.net/AcquireLicense", - "httpRequestHeaders": { - "X-AxDRM-Message": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiNmU1YTFkMjYtMjc1Ny00N2Q3LTgwNDYtZWFhNWQxZDM0YjVhIn1dfX0.yF7PflOPv9qHnu3ZWJNZ12jgkqTabmwXbDWk_47tLNE" - } - } - }, - "moreInfo": "https://github.com/Axinom/dash-test-vectors/tree/conservative", - "provider": "axinom" - }, - { - "name": "1080p with PlayReady and Widevine DRM, multiple keys", - "url": "https://media.axprod.net/TestVectors/v6.1-MultiDRM-MultiKey/Manifest_1080p.mpd", - "protData": { - "com.widevine.alpha": { - "serverURL": "https://drm-widevine-licensing.axtest.net/AcquireLicense", - "httpRequestHeaders": { - "X-AxDRM-Message": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiMTUzMGQzYTAtNjkwNC00NDZhLTkxYTEtMzNhMTE1YWE4YzQxIn0seyJpZCI6ImM4M2ViNjM5LWU2NjQtNDNmOC1hZTk4LTQwMzliMGMxM2IyZCJ9LHsiaWQiOiIzZDhjYzc2Mi0yN2FjLTQwMGYtOTg5Zi04YWI1ZGM3ZDc3NzUifSx7ImlkIjoiYmQ4ZGFkNTgtMDMyZC00YzI1LTg5ZmEtYzdiNzEwZTgyYWMyIn1dfX0.9t18lFmZFVHMzpoZxYDyqOS0Bk_evGhTBw_F2JnAK2k" - }, - "httpTimeout": 5000 - }, - "com.microsoft.playready": { - "serverURL": "https://drm-playready-licensing.axtest.net/AcquireLicense", - "httpRequestHeaders": { - "X-AxDRM-Message": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiMTUzMGQzYTAtNjkwNC00NDZhLTkxYTEtMzNhMTE1YWE4YzQxIn0seyJpZCI6ImM4M2ViNjM5LWU2NjQtNDNmOC1hZTk4LTQwMzliMGMxM2IyZCJ9LHsiaWQiOiIzZDhjYzc2Mi0yN2FjLTQwMGYtOTg5Zi04YWI1ZGM3ZDc3NzUifSx7ImlkIjoiYmQ4ZGFkNTgtMDMyZC00YzI1LTg5ZmEtYzdiNzEwZTgyYWMyIn1dfX0.9t18lFmZFVHMzpoZxYDyqOS0Bk_evGhTBw_F2JnAK2k" - }, - "httpTimeout": 5000 - } - }, - "moreInfo": "https://github.com/Axinom/dash-test-vectors/tree/conservative", - "provider": "axinom" - }, - { - "name": "2160p with PlayReady and Widevine DRM, single key", - "url": "https://media.axprod.net/TestVectors/v6.1-MultiDRM/Manifest.mpd", - "protData": { - "com.widevine.alpha": { - "serverURL": "https://drm-widevine-licensing.axtest.net/AcquireLicense", - "httpRequestHeaders": { - "X-AxDRM-Message": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiNmU1YTFkMjYtMjc1Ny00N2Q3LTgwNDYtZWFhNWQxZDM0YjVhIn1dfX0.yF7PflOPv9qHnu3ZWJNZ12jgkqTabmwXbDWk_47tLNE" - }, - "httpTimeout": 5000 - }, - "com.microsoft.playready": { - "serverURL": "https://drm-playready-licensing.axtest.net/AcquireLicense", - "httpRequestHeaders": { - "X-AxDRM-Message": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiNmU1YTFkMjYtMjc1Ny00N2Q3LTgwNDYtZWFhNWQxZDM0YjVhIn1dfX0.yF7PflOPv9qHnu3ZWJNZ12jgkqTabmwXbDWk_47tLNE" - }, - "httpTimeout": 5000 - } - }, - "moreInfo": "https://github.com/Axinom/dash-test-vectors/tree/conservative", - "provider": "axinom" - }, - { - "name": "2160p with PlayReady and Widevine DRM, multiple keys", - "url": "https://media.axprod.net/TestVectors/v6.1-MultiDRM-MultiKey/Manifest.mpd", - "protData": { - "com.widevine.alpha": { - "serverURL": "https://drm-widevine-licensing.axtest.net/AcquireLicense", - "httpRequestHeaders": { - "X-AxDRM-Message": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiMTUzMGQzYTAtNjkwNC00NDZhLTkxYTEtMzNhMTE1YWE4YzQxIn0seyJpZCI6ImM4M2ViNjM5LWU2NjQtNDNmOC1hZTk4LTQwMzliMGMxM2IyZCJ9LHsiaWQiOiIzZDhjYzc2Mi0yN2FjLTQwMGYtOTg5Zi04YWI1ZGM3ZDc3NzUifSx7ImlkIjoiYmQ4ZGFkNTgtMDMyZC00YzI1LTg5ZmEtYzdiNzEwZTgyYWMyIn1dfX0.9t18lFmZFVHMzpoZxYDyqOS0Bk_evGhTBw_F2JnAK2k" - }, - "httpTimeout": 5000 - }, - "com.microsoft.playready": { - "serverURL": "https://drm-playready-licensing.axtest.net/AcquireLicense", - "httpRequestHeaders": { - "X-AxDRM-Message": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiMTUzMGQzYTAtNjkwNC00NDZhLTkxYTEtMzNhMTE1YWE4YzQxIn0seyJpZCI6ImM4M2ViNjM5LWU2NjQtNDNmOC1hZTk4LTQwMzliMGMxM2IyZCJ9LHsiaWQiOiIzZDhjYzc2Mi0yN2FjLTQwMGYtOTg5Zi04YWI1ZGM3ZDc3NzUifSx7ImlkIjoiYmQ4ZGFkNTgtMDMyZC00YzI1LTg5ZmEtYzdiNzEwZTgyYWMyIn1dfX0.9t18lFmZFVHMzpoZxYDyqOS0Bk_evGhTBw_F2JnAK2k" - }, - "httpTimeout": 5000 - } - }, - "moreInfo": "https://github.com/Axinom/dash-test-vectors/tree/conservative", - "provider": "axinom" - }, - { - "name": "Multi-period 1080p with PlayReady and Widevine DRM, multiple keys", - "url": "https://media.axprod.net/TestVectors/v6.1-MultiDRM-MultiKey-MultiPeriod/Manifest_1080p.mpd", - "protData": { - "com.widevine.alpha": { - "serverURL": "https://drm-widevine-licensing.axtest.net/AcquireLicense", - "httpRequestHeaders": { - "X-AxDRM-Message": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiNTNiZTc3NTctNzI4OC00YjZiLWIyMGEtZjA1YjY0YTRlZjc5In0seyJpZCI6IjBlZDgyMWE4LTgwZWQtNDBhYy1hODA0LTkyN2M5ZmRhZGJlOSJ9LHsiaWQiOiJlNDdkNzhjYS05NGRjLTQ1ZmItOWUzZC0yYTc3M2FlZjc0YjIifSx7ImlkIjoiMzJhMTQxZTktMjNhYi00NGZmLWE2YzctNTM0OWM4OTQ1MWNmIn0seyJpZCI6IjhkMDkxOTY2LTQ0YjUtNGNmOC04YTQ1LWVkMTJmZGIxOGQzNSJ9XX19.9YSK6QsDr4SYR7Q74ftq9mVtsT0ZkP3STE0zI-3mVIA" - }, - "httpTimeout": 5000 - }, - "com.microsoft.playready": { - "serverURL": "https://drm-playready-licensing.axtest.net/AcquireLicense", - "httpRequestHeaders": { - "X-AxDRM-Message": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiNTNiZTc3NTctNzI4OC00YjZiLWIyMGEtZjA1YjY0YTRlZjc5In0seyJpZCI6IjBlZDgyMWE4LTgwZWQtNDBhYy1hODA0LTkyN2M5ZmRhZGJlOSJ9LHsiaWQiOiJlNDdkNzhjYS05NGRjLTQ1ZmItOWUzZC0yYTc3M2FlZjc0YjIifSx7ImlkIjoiMzJhMTQxZTktMjNhYi00NGZmLWE2YzctNTM0OWM4OTQ1MWNmIn0seyJpZCI6IjhkMDkxOTY2LTQ0YjUtNGNmOC04YTQ1LWVkMTJmZGIxOGQzNSJ9XX19.9YSK6QsDr4SYR7Q74ftq9mVtsT0ZkP3STE0zI-3mVIA" - }, - "httpTimeout": 5000 - } - }, - "moreInfo": "https://github.com/Axinom/dash-test-vectors/tree/conservative", - "provider": "axinom" - }, - { - "name": "Multi-period 2160p with PlayReady and Widevine DRM, multiple keys", - "url": "https://media.axprod.net/TestVectors/v6.1-MultiDRM-MultiKey-MultiPeriod/Manifest.mpd", - "protData": { - "com.widevine.alpha": { - "serverURL": "https://drm-widevine-licensing.axtest.net/AcquireLicense", - "httpRequestHeaders": { - "X-AxDRM-Message": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiNTNiZTc3NTctNzI4OC00YjZiLWIyMGEtZjA1YjY0YTRlZjc5In0seyJpZCI6IjBlZDgyMWE4LTgwZWQtNDBhYy1hODA0LTkyN2M5ZmRhZGJlOSJ9LHsiaWQiOiJlNDdkNzhjYS05NGRjLTQ1ZmItOWUzZC0yYTc3M2FlZjc0YjIifSx7ImlkIjoiMzJhMTQxZTktMjNhYi00NGZmLWE2YzctNTM0OWM4OTQ1MWNmIn0seyJpZCI6IjhkMDkxOTY2LTQ0YjUtNGNmOC04YTQ1LWVkMTJmZGIxOGQzNSJ9XX19.9YSK6QsDr4SYR7Q74ftq9mVtsT0ZkP3STE0zI-3mVIA" - }, - "httpTimeout": 5000 - }, - "com.microsoft.playready": { - "serverURL": "https://drm-playready-licensing.axtest.net/AcquireLicense", - "httpRequestHeaders": { - "X-AxDRM-Message": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiNjllNTQwODgtZTllMC00NTMwLThjMWEtMWViNmRjZDBkMTRlIiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImtleXMiOlt7ImlkIjoiNTNiZTc3NTctNzI4OC00YjZiLWIyMGEtZjA1YjY0YTRlZjc5In0seyJpZCI6IjBlZDgyMWE4LTgwZWQtNDBhYy1hODA0LTkyN2M5ZmRhZGJlOSJ9LHsiaWQiOiJlNDdkNzhjYS05NGRjLTQ1ZmItOWUzZC0yYTc3M2FlZjc0YjIifSx7ImlkIjoiMzJhMTQxZTktMjNhYi00NGZmLWE2YzctNTM0OWM4OTQ1MWNmIn0seyJpZCI6IjhkMDkxOTY2LTQ0YjUtNGNmOC04YTQ1LWVkMTJmZGIxOGQzNSJ9XX19.9YSK6QsDr4SYR7Q74ftq9mVtsT0ZkP3STE0zI-3mVIA" - }, - "httpTimeout": 5000 - } - }, - "moreInfo": "https://github.com/Axinom/dash-test-vectors/tree/conservative", - "provider": "axinom" - } - ] - }, { "name": "Thumbnails", "submenu": [ diff --git a/src/dash/constants/DashConstants.js b/src/dash/constants/DashConstants.js index c2fffbf007..f61aa343f0 100644 --- a/src/dash/constants/DashConstants.js +++ b/src/dash/constants/DashConstants.js @@ -94,6 +94,7 @@ export default { INDEX_RANGE: 'indexRange', INITIALIZATION: 'Initialization', INITIALIZATION_MINUS: 'initialization', + LA_URL: 'Laurl', LABEL: 'Label', LANG: 'lang', LOCATION: 'Location', diff --git a/src/dash/vo/ContentProtection.js b/src/dash/vo/ContentProtection.js index 7bbc34b537..bfaefc155f 100644 --- a/src/dash/vo/ContentProtection.js +++ b/src/dash/vo/ContentProtection.js @@ -43,10 +43,14 @@ class ContentProtection extends DescriptorType { this.refId = null; this.robustness = null; this.keyId = null; + this.pssh = null; + this.pro = null; + this.laUrl = null; } init(data) { super.init(data); + if (data) { this.ref = data.hasOwnProperty(DashConstants.REF) ? data[DashConstants.REF] : null; this.refId = data.hasOwnProperty(DashConstants.REF_ID) ? data[DashConstants.REF_ID] : null; @@ -54,31 +58,17 @@ class ContentProtection extends DescriptorType { this.cencDefaultKid = data.hasOwnProperty(DashConstants.CENC_DEFAULT_KID) ? data[DashConstants.CENC_DEFAULT_KID] : null; this.pssh = data.hasOwnProperty(DashConstants.PSSH) ? data[DashConstants.PSSH] : null; this.pro = data.hasOwnProperty(DashConstants.PRO) ? data[DashConstants.PRO] : null; + this.laUrl = data.hasOwnProperty(DashConstants.LA_URL) ? data[DashConstants.LA_URL] : null; } } mergeAttributesFromReference(reference) { - if (this.schemeIdUri === null) { - this.schemeIdUri = reference.schemeIdUri - } - if (this.value === null) { - this.value = reference.value - } - if (this.id === null) { - this.id = reference.id - } - if (this.robustness === null) { - this.robustness = reference.robustness; - } - if (this.cencDefaultKid === null) { - this.cencDefaultKid = reference.cencDefaultKid; - } - if (this.pro === null) { - this.pro = reference.pro; - } - if (this.pssh === null) { - this.pssh = reference.pssh; - } + let attributesToBeMerged = ['schemeIdUri', 'value', 'id', 'robustness', 'cencDefaultKid', 'pro', 'pssh', 'laUrl'] + attributesToBeMerged.forEach((attribute) => { + if (this[attribute] === null) { + this[attribute] = reference[attribute] + } + }) } } diff --git a/src/streaming/protection/CommonEncryption.js b/src/streaming/protection/CommonEncryption.js index d46c3ce221..6606d08b1d 100644 --- a/src/streaming/protection/CommonEncryption.js +++ b/src/streaming/protection/CommonEncryption.js @@ -31,8 +31,7 @@ import DashConstants from '../../dash/constants/DashConstants.js'; const LICENSE_SERVER_MANIFEST_CONFIGURATIONS = { - attributes: ['Laurl', 'laurl'], - prefixes: ['clearkey', 'dashif'] + prefixes: ['clearkey', 'dashif', 'ck'] }; /** @@ -218,40 +217,33 @@ class CommonEncryption { return pssh; } - static getLicenseServerUrlFromMediaInfo(mediaInfo, schemeIdUri) { + static getLicenseServerUrlFromMediaInfo(mediaInfoArr, schemeIdUri) { try { - if (!mediaInfo || mediaInfo.length === 0) { + if (!mediaInfoArr || mediaInfoArr.length === 0) { return null; } let i = 0; let licenseServer = null; - while (i < mediaInfo.length && !licenseServer) { - const info = mediaInfo[i]; + while (i < mediaInfoArr.length && !licenseServer) { + const mediaInfo = mediaInfoArr[i]; - if (info && info.contentProtection && info.contentProtection.length > 0) { - const targetProtectionData = info.contentProtection.filter((cp) => { + if (mediaInfo && mediaInfo.contentProtection && mediaInfo.contentProtection.length > 0) { + const targetProtectionData = mediaInfo.contentProtection.filter((cp) => { return cp.schemeIdUri && cp.schemeIdUri === schemeIdUri; }); if (targetProtectionData && targetProtectionData.length > 0) { let j = 0; while (j < targetProtectionData.length && !licenseServer) { - const ckData = targetProtectionData[j]; - let k = 0; - while (k < LICENSE_SERVER_MANIFEST_CONFIGURATIONS.attributes.length && !licenseServer) { - let l = 0; - const attribute = LICENSE_SERVER_MANIFEST_CONFIGURATIONS.attributes[k]; - while (l < LICENSE_SERVER_MANIFEST_CONFIGURATIONS.prefixes.length && !licenseServer) { - const prefix = LICENSE_SERVER_MANIFEST_CONFIGURATIONS.prefixes[l]; - if (ckData[attribute] && ckData[attribute].__prefix && ckData[attribute].__prefix === prefix && ckData[attribute].__text) { - licenseServer = ckData[attribute].__text; - } - l += 1; - } - k += 1; + const contentProtection = targetProtectionData[j]; + if (contentProtection.laUrl + && contentProtection.laUrl.__prefix + && LICENSE_SERVER_MANIFEST_CONFIGURATIONS.prefixes.includes(contentProtection.laUrl.__prefix) + && contentProtection.laUrl.__text) { + licenseServer = contentProtection.laUrl.__text; } j += 1; } diff --git a/src/streaming/protection/controllers/ProtectionController.js b/src/streaming/protection/controllers/ProtectionController.js index dbd5b171cd..46be18fe2d 100644 --- a/src/streaming/protection/controllers/ProtectionController.js +++ b/src/streaming/protection/controllers/ProtectionController.js @@ -326,15 +326,16 @@ function ProtectionController(config) { * @ignore */ function createKeySession(keySystemInfo) { + + // Check for duplicate key id + if (keySystemInfo && _isKeyIdDuplicate(keySystemInfo.keyId)) { + return; + } + const initDataForKS = CommonEncryption.getPSSHForKeySystem(selectedKeySystem, keySystemInfo ? keySystemInfo.initData : null); if (initDataForKS) { - // Check for duplicate key id - if (_isKeyIdDuplicate(keySystemInfo.keyId)) { - return; - } - // Check for duplicate initData if (_isInitDataDuplicate(initDataForKS)) { return; diff --git a/test/unit/streaming.protection.CommonEncryption.js b/test/unit/streaming.protection.CommonEncryption.js index 3b6d6a3e12..9b0ef220c5 100644 --- a/test/unit/streaming.protection.CommonEncryption.js +++ b/test/unit/streaming.protection.CommonEncryption.js @@ -2,6 +2,7 @@ import CommonEncryption from '../../src/streaming/protection/CommonEncryption.js import Base64 from '../../externals/base64.js'; import {expect} from 'chai'; + let cpData; describe('CommonEncryption', () => { @@ -74,7 +75,7 @@ describe('CommonEncryption', () => { contentProtection: [ { schemeIdUri: schemeIdUri, - laurl: { + laUrl: { __prefix: 'dashif', __text: 'license-server-url' } @@ -83,6 +84,10 @@ describe('CommonEncryption', () => { }] }); + afterEach(() => { + mediaInfo = null; + }) + it('should return null in case the schemeIdUri does not match', () => { const result = CommonEncryption.getLicenseServerUrlFromMediaInfo(mediaInfo, 'nomatch'); @@ -90,21 +95,21 @@ describe('CommonEncryption', () => { }); it('should return null if license server url is empty', () => { - mediaInfo[0].contentProtection[0].laurl.__text = ''; + mediaInfo[0].contentProtection[0].laUrl.__text = ''; const result = CommonEncryption.getLicenseServerUrlFromMediaInfo(mediaInfo, schemeIdUri); expect(result).to.be.null; }) it('should return null if wrong prefix', () => { - mediaInfo[0].contentProtection[0].laurl.__prefix = 'wrongprefix'; + mediaInfo[0].contentProtection[0].laUrl.__prefix = 'wrongprefix'; const result = CommonEncryption.getLicenseServerUrlFromMediaInfo(mediaInfo, schemeIdUri); expect(result).to.be.null; }) it('should return null if wrong attribute', () => { - delete mediaInfo[0].contentProtection[0].laurl; + delete mediaInfo[0].contentProtection[0].laUrl; const result = CommonEncryption.getLicenseServerUrlFromMediaInfo(mediaInfo, schemeIdUri); expect(result).to.be.null; @@ -116,12 +121,19 @@ describe('CommonEncryption', () => { expect(result).to.be.equal('license-server-url'); }) - it('should return valid license server for dashif:Laurl', () => { - delete mediaInfo[0].contentProtection[0].laurl; - mediaInfo[0].contentProtection[0].Laurl = { __prefix: 'dashif', __text: 'license-server-url' }; + it('should return valid license server for clearkey:laurl', () => { + mediaInfo[0].contentProtection[0].__prefix = 'clearkey' const result = CommonEncryption.getLicenseServerUrlFromMediaInfo(mediaInfo, schemeIdUri); expect(result).to.be.equal('license-server-url'); }) + + it('should return valid license server for ck:laurl', () => { + mediaInfo[0].contentProtection[0].__prefix = 'ck' + const result = CommonEncryption.getLicenseServerUrlFromMediaInfo(mediaInfo, schemeIdUri); + + expect(result).to.be.equal('license-server-url'); + }) + }); })