Skip to content

Commit

Permalink
Update EME polyfills setServerCertificate to spec
Browse files Browse the repository at this point in the history
The method should return a Promise resolved with false if unsupported.

Change-Id: I304f2566fc2cf6521eb35f963d7c862e3eca1f48
  • Loading branch information
joeyparrish committed May 8, 2017
1 parent e487cad commit 67fa39c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 6 additions & 2 deletions lib/media/drm_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,12 @@ shaka.media.DrmEngine.prototype.attach = function(video) {
var setServerCertificate = null;
if (this.currentDrmInfo_.serverCertificate) {
setServerCertificate = this.mediaKeys_.setServerCertificate(
this.currentDrmInfo_.serverCertificate);
setServerCertificate = setServerCertificate.catch(function(exception) {
this.currentDrmInfo_.serverCertificate).then(function(supported) {
if (!supported) {
shaka.log.warning('Server certificates are not supported by the key' +
' system. The server certificate has been ignored.');
}
}).catch(function(exception) {
return Promise.reject(new shaka.util.Error(
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.DRM,
Expand Down
3 changes: 1 addition & 2 deletions lib/polyfill/patchedmediakeys_ms.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ shaka.polyfill.PatchedMediaKeysMs.MediaKeys.prototype.
shaka.log.debug('PatchedMediaKeysMs.MediaKeys.setServerCertificate');

// There is no equivalent in PatchedMediaKeysMs, so return failure.
return Promise.reject(new Error('setServerCertificate not supported on ' +
'this platform.'));
return Promise.resolve(false);
};


Expand Down
3 changes: 1 addition & 2 deletions lib/polyfill/patchedmediakeys_webkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,7 @@ shaka.polyfill.PatchedMediaKeysWebkit.MediaKeys.prototype.setServerCertificate =
shaka.log.debug('PatchedMediaKeysWebkit.MediaKeys.setServerCertificate');

// There is no equivalent in v0.1b, so return failure.
return Promise.reject(new Error(
'setServerCertificate not supported on this platform.'));
return Promise.resolve(false);
};


Expand Down

0 comments on commit 67fa39c

Please sign in to comment.