Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adrums86 committed Feb 15, 2024
1 parent 3e5b9e2 commit 0740ed1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/fairplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const addKey = ({video, contentId, initData, cert, options, getLicense, eventBus
return new Promise((resolve, reject) => {
if (!video.webkitKeys) {
try {
video.webkitSetMediaKeys(new window.WebKitMediaKeys(FAIRPLAY_KEY_SYSTEM));
video.webkitSetMediaKeys(new window.WebKitMediaKeys(LEGACY_FAIRPLAY_KEY_SYSTEM));
} catch (error) {
reject('Could not create MediaKeys');
return;
Expand Down Expand Up @@ -154,7 +154,7 @@ export const defaultGetLicense = (fairplayOptions) => {
};

const fairplay = ({video, initData, options, eventBus}) => {
const fairplayOptions = options.keySystems[FAIRPLAY_KEY_SYSTEM];
const fairplayOptions = options.keySystems[LEGACY_FAIRPLAY_KEY_SYSTEM];
const getCertificate = fairplayOptions.getCertificate ||
defaultGetCertificate(fairplayOptions);
const getContentId = fairplayOptions.getContentId || defaultGetContentId;
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ const onPlayerReady = (player, emeError) => {
setupSessions(player);

const playerOptions = getOptions(player);
const isLegacyFairplay = playerOptions.keySystem[LEGACY_FAIRPLAY_KEY_SYSTEM];
const isLegacyFairplay = playerOptions.keySystem && playerOptions.keySystem[LEGACY_FAIRPLAY_KEY_SYSTEM];

if (window.MediaKeys && !isLegacyFairplay) {
// Support EME 05 July 2016
Expand Down
18 changes: 9 additions & 9 deletions test/fairplay.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import QUnit from 'qunit';
import {
default as fairplay,
FAIRPLAY_KEY_SYSTEM,
defaultGetLicense,
defaultGetCertificate
defaultGetCertificate,
LEGACY_FAIRPLAY_KEY_SYSTEM
} from '../src/fairplay';
import videojs from 'video.js';
import window from 'global/window';
Expand Down Expand Up @@ -170,7 +170,7 @@ QUnit.test('error in getCertificate rejects promise', function(assert) {
const keySystems = {};
const done = assert.async(1);

keySystems[FAIRPLAY_KEY_SYSTEM] = {
keySystems[LEGACY_FAIRPLAY_KEY_SYSTEM] = {
getCertificate: (options, callback) => {
callback('error in getCertificate');
}
Expand All @@ -195,7 +195,7 @@ QUnit.test('error in WebKitMediaKeys rejects promise', function(assert) {
throw new Error('unsupported keySystem');
};

keySystems[FAIRPLAY_KEY_SYSTEM] = {};
keySystems[LEGACY_FAIRPLAY_KEY_SYSTEM] = {};

fairplay({
video,
Expand All @@ -221,7 +221,7 @@ QUnit.test('error in webkitSetMediaKeys rejects promise', function(assert) {

window.WebKitMediaKeys = function() {};

keySystems[FAIRPLAY_KEY_SYSTEM] = {};
keySystems[LEGACY_FAIRPLAY_KEY_SYSTEM] = {};

fairplay({
video,
Expand Down Expand Up @@ -251,7 +251,7 @@ QUnit.test('error in webkitKeys.createSession rejects promise', function(assert)

window.WebKitMediaKeys = function() {};

keySystems[FAIRPLAY_KEY_SYSTEM] = {};
keySystems[LEGACY_FAIRPLAY_KEY_SYSTEM] = {};

fairplay({
video,
Expand Down Expand Up @@ -290,7 +290,7 @@ QUnit.test('error in getLicense rejects promise', function(assert) {

window.WebKitMediaKeys = function() {};

keySystems[FAIRPLAY_KEY_SYSTEM] = {
keySystems[LEGACY_FAIRPLAY_KEY_SYSTEM] = {
getLicense: (options, contentId, message, callback) => {
callback('error in getLicense');
}
Expand Down Expand Up @@ -336,7 +336,7 @@ QUnit.test('keysessioncreated fired on key session created', function(assert) {

window.WebKitMediaKeys = function() {};

keySystems[FAIRPLAY_KEY_SYSTEM] = {
keySystems[LEGACY_FAIRPLAY_KEY_SYSTEM] = {
licenseUri: 'some-url',
certificateUri: 'some-other-url'
};
Expand Down Expand Up @@ -376,7 +376,7 @@ QUnit.test('a webkitkeyerror rejects promise', function(assert) {

window.WebKitMediaKeys = function() {};

keySystems[FAIRPLAY_KEY_SYSTEM] = {
keySystems[LEGACY_FAIRPLAY_KEY_SYSTEM] = {
getLicense: (options, contentId, message, callback) => {
callback(null);
keySession.trigger('webkitkeyerror');
Expand Down

0 comments on commit 0740ed1

Please sign in to comment.