Skip to content

Commit

Permalink
Update Edge workaround in DrmEngine.
Browse files Browse the repository at this point in the history
Edge recently pushed an update which fixed a bug that we were working
around.  This was that it didn't support multiple MIME types when
querying EME.  Now it will allow multiples to be passed in.

However, Edge's update also introduced a new bug that when getting the
configuration from the access object, it doesn't report the correct
MIME types.  It should include every MIME type that is supported,
but it only includes the first one.

Closes shaka-project#634

Change-Id: I7156887a112dc844b3cbc9bb2dd9676afee6cf56
  • Loading branch information
TheModMaker authored and birme committed Dec 28, 2016
1 parent 757aa90 commit 11d901d
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions lib/media/drm_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,6 @@ shaka.media.DrmEngine.prototype.prepareMediaKeyConfigs_ =
function(manifest, offline, configsByKeySystem, keySystemsInOrder) {
var clearKeyDrmInfo = this.configureClearKey_();

// TODO: Remove once Edge has released a fix for https://goo.gl/vr2Vle
var isEdge = navigator.userAgent.indexOf('Edge/') >= 0;

manifest.periods.forEach(function(period) {
period.streamSets.forEach(function(streamSet) {
if (streamSet.type == 'text')
Expand Down Expand Up @@ -444,14 +441,6 @@ shaka.media.DrmEngine.prototype.prepareMediaKeyConfigs_ =
drmInfo.keyIds.push(stream.keyId);
}

// Edge 13 fails this negotiation with NotSupportedError if more than
// one entry is given, even if each entry individually would be
// supported. Bug filed: https://goo.gl/vr2Vle
// TODO: Remove once Edge has released a fix.
if (isEdge && drmInfo.keySystem == 'com.microsoft.playready' &&
capabilities.length) {
return;
}
capabilities.push({
robustness: robustness,
contentType: fullMimeType
Expand Down Expand Up @@ -524,19 +513,25 @@ shaka.media.DrmEngine.prototype.queryMediaKeys_ =
p = p.then(function(mediaKeySystemAccess) {
if (this.destroyed_) return Promise.reject();

// TODO: Remove once Edge has released a fix for https://goo.gl/qMeV7v
var isEdge = navigator.userAgent.indexOf('Edge/') >= 0;

// Store the capabilities of the key system.
var realConfig = mediaKeySystemAccess.getConfiguration();
var audioCaps = realConfig.audioCapabilities || [];
var videoCaps = realConfig.videoCapabilities || [];
var caps = audioCaps.concat(videoCaps);
this.supportedTypes_ = caps.map(function(c) { return c.contentType; });
if (this.supportedTypes_.length == 0) {
// Edge 13 does not report capabilities. To work around this, set the
// supported types to null, which Player will use as a signal that the
// information is not available.
// See: https://goo.gl/0cSuT2
if (isEdge) {
// Edge 14 does not report correct capabilities. It will only report the
// first MIME type even if the others are supported. To work around this,
// set the supported types to null, which Player will use as a signal that
// the information is not available.
// See: https://goo.gl/qMeV7v
this.supportedTypes_ = null;
}
goog.asserts.assert(!this.supportedTypes_ || this.supportedTypes_.length,
'We should get at least one supported MIME type');

var originalConfig = configsByKeySystem[mediaKeySystemAccess.keySystem];
this.createCurrentDrmInfo_(
Expand Down

0 comments on commit 11d901d

Please sign in to comment.