Skip to content

Commit

Permalink
Leave unused MKSC fields undefined.
Browse files Browse the repository at this point in the history
This fixes EME draft spec compliance issues.

Closes #45.

(Issue #45, back-ported to v1.2.x branch)

Change-Id: Ida55d5a14da03acdc0120fb5946c33ab42d800c3
  • Loading branch information
joeyparrish committed Apr 7, 2015
1 parent 612b320 commit 8b20bef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
10 changes: 5 additions & 5 deletions externs/mediakeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ var MediaKeySystemMediaCapability;


/** @typedef {{
* initDataTypes: Array.<string>,
* audioCapabilities: Array.<!MediaKeySystemMediaCapability>,
* videoCapabilities: Array.<!MediaKeySystemMediaCapability>,
* distinctiveIdentifier: string,
* persistentState: string
* initDataTypes: (Array.<string>|undefined),
* audioCapabilities: (Array.<!MediaKeySystemMediaCapability>|undefined),
* videoCapabilities: (Array.<!MediaKeySystemMediaCapability>|undefined),
* distinctiveIdentifier: (string|undefined),
* persistentState: (string|undefined)
* }} */
var MediaKeySystemConfiguration;

Expand Down
16 changes: 10 additions & 6 deletions lib/player/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,9 @@ shaka.player.Player.prototype.buildKeySystemQueries_ =
var mksc = mediaKeySystemConfigs[keySystem];
if (!mksc) {
mksc = mediaKeySystemConfigs[keySystem] = {
audioCapabilities: [],
videoCapabilities: [],
initDataTypes: [],
audioCapabilities: undefined,
videoCapabilities: undefined,
initDataTypes: undefined,
distinctiveIdentifier: 'optional',
persistentState: 'optional'
};
Expand All @@ -433,9 +433,12 @@ shaka.player.Player.prototype.buildKeySystemQueries_ =
if (!cfg.fullMimeType) continue;

var capName = cfg.contentType + 'Capabilities';
if (!mksc[capName]) continue; // not a capability we can check for!
if (!(capName in mksc)) continue; // not a capability we can check for!

anythingSpecified = true;
if (!mksc[capName]) {
mksc[capName] = [];
}
mksc[capName].push({ contentType: cfg.fullMimeType });
}

Expand Down Expand Up @@ -496,8 +499,9 @@ shaka.player.Player.prototype.chooseEncrypted_ =
if (chosenStreams.has(contentType)) continue; // not needed!

var capName = contentType + 'Capabilities';
var caps = mksc[capName][0];
if (!caps) continue; // type not found!
var caps = mksc[capName];
if (!caps || !caps.length) continue; // type not found!
caps = caps[0];

// Find which StreamConfigs match the selected MediaKeySystemConfiguration.
var chosenCfgs = [];
Expand Down

0 comments on commit 8b20bef

Please sign in to comment.