Skip to content

Commit

Permalink
give all the mediaKeyInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
valotvince committed Apr 29, 2020
1 parent 49b98c9 commit 8077c9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/controller/eme-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
10 changes: 6 additions & 4 deletions src/utils/mediakeys-helper.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { MediaKeysListItem } from '../controller/eme-controller';

/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/requestMediaKeySystemAccess
*/
Expand All @@ -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
/*
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 8077c9e

Please sign in to comment.