diff --git a/src/controller/eme-controller.ts b/src/controller/eme-controller.ts index 12fa12b35d2..fd81469b5e9 100644 --- a/src/controller/eme-controller.ts +++ b/src/controller/eme-controller.ts @@ -543,7 +543,7 @@ class EMEController extends EventHandler { const url = this.getLicenseServerUrl(keysListItem.mediaKeySystemDomain); logger.log(`Sending license request to URL: ${url}`); - const challenge = this.emeGenerateLicenseChallengeFunc(keysListItem.mediaKeySystemDomain, keyMessage); + const challenge = this.emeGenerateLicenseChallengeFunc(keysListItem, keyMessage); xhr.send(challenge); }) .catch(e => { diff --git a/src/utils/mediakeys-helper.ts b/src/utils/mediakeys-helper.ts index 11605ea0382..c32e7169e24 100644 --- a/src/utils/mediakeys-helper.ts +++ b/src/utils/mediakeys-helper.ts @@ -1,3 +1,5 @@ +import { MediaKeysListItem } from '../controller/eme-controller'; + /** * @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/requestMediaKeySystemAccess */ @@ -16,9 +18,9 @@ const requestMediaKeySystemAccess = (function (): MediaKeyFunc | null { } })(); -export type GenerateLicenseChallengFunc = (keySystem: KeySystems, keyMessage: ArrayBuffer) => ArrayBuffer; -const generateLicenseChallenge = (keySystem: KeySystems, keyMessage: ArrayBuffer): ArrayBuffer => { - switch (keySystem) { +export type GenerateLicenseChallengFunc = (keySystemItem: MediaKeysListItem, keyMessage: ArrayBuffer) => ArrayBuffer; +const generateLicenseChallenge = (keySystemItem: MediaKeysListItem, keyMessage: ArrayBuffer): ArrayBuffer => { + switch (keySystemItem.mediaKeySystemDomain) { // case KeySystems.PLAYREADY: // from https://github.com/MicrosoftEdge/Demos/blob/master/eme/scripts/demo.js /* @@ -47,7 +49,7 @@ const generateLicenseChallenge = (keySystem: KeySystems, keyMessage: ArrayBuffer return keyMessage; } - throw new Error(`unsupported key-system: ${keySystem}`); + throw new Error(`unsupported key-system: ${keySystemItem.mediaKeySystemDomain}`); }; export {