Skip to content

Commit

Permalink
fix: Do not make LICENSE_REQUEST_FAILED fatal if other keys are succe…
Browse files Browse the repository at this point in the history
…ssful (#6457)

Fixes #3051
  • Loading branch information
avelad authored and joeyparrish committed May 7, 2024
1 parent 552255b commit 913f5c1
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions lib/media/drm_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,9 @@ shaka.media.DrmEngine = class {
const req = this.playerInterface_.netEngine.request(requestType, request);
response = await req.promise;
} catch (error) {
if (this.destroyer_.destroyed()) {
return;
}
// Request failed!
goog.asserts.assert(error instanceof shaka.util.Error,
'Wrong NetworkingEngine error type!');
Expand All @@ -1559,9 +1562,20 @@ shaka.media.DrmEngine = class {
shaka.util.Error.Category.DRM,
shaka.util.Error.Code.LICENSE_REQUEST_FAILED,
error);
this.onError_(shakaErr);
if (metadata && metadata.updatePromise) {
metadata.updatePromise.reject(shakaErr);
if (this.activeSessions_.size == 1) {
this.onError_(shakaErr);
if (metadata && metadata.updatePromise) {
metadata.updatePromise.reject(shakaErr);
}
} else {
if (metadata && metadata.updatePromise) {
metadata.updatePromise.reject(shakaErr);
}
this.activeSessions_.delete(session);
if (this.areAllSessionsLoaded_()) {
this.allSessionsLoaded_.resolve();
this.keyStatusTimer_.tickAfter(/* seconds= */ 0.1);
}
}
return;
}
Expand Down

0 comments on commit 913f5c1

Please sign in to comment.