From 11d901dc49eb91e61333f187a6ed6640a88208b3 Mon Sep 17 00:00:00 2001 From: Jacob Trimble Date: Tue, 27 Dec 2016 13:46:32 -0800 Subject: [PATCH] Update Edge workaround in DrmEngine. 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 #634 Change-Id: I7156887a112dc844b3cbc9bb2dd9676afee6cf56 --- lib/media/drm_engine.js | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/lib/media/drm_engine.js b/lib/media/drm_engine.js index c5532fb4b0..af337186b9 100644 --- a/lib/media/drm_engine.js +++ b/lib/media/drm_engine.js @@ -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') @@ -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 @@ -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_(