Skip to content

Commit

Permalink
fix: Do not report MANIFEST RESTRICTIONS_CANNOT_BE_MET error twice (#…
Browse files Browse the repository at this point in the history
…4194)

We want to avoid reporting MANIFEST RESTRICTIONS_CANNOT_BE_MET error twice.

This is because when error detected from `onKeyStatus_` calls `updateAbrManagerVariants_` which calls `checkRestrictedVariants_` and error is catched and propagated from `onError_` **but source code execution continues** 
and `chooseVariantAndSwitch_` triggers same error again:

```javascript
onKeyStatus_() {
  ....
  if (tracksChanged) {
    this.updateAbrManagerVariants_(); 
    //   -> checkRestrictedVariants_ 
    //     -> RESTRICTIONS_CANNOT_BE_MET
  }
  ...
  if (currentVariant && !currentVariant.allowedByKeySystem) {
    ...
    this.chooseVariantAndSwitch_(); 
    //  -> chooseVariant_
    //    -> updateAbrManagerVariants_ 
    //      -> checkRestrictedVariants_ 
    //        -> RESTRICTIONS_CANNOT_BE_MET
  }
```

Closes #4190
  • Loading branch information
albertdaurell authored and joeyparrish committed May 17, 2022
1 parent 951017e commit 28d651b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -5661,7 +5661,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
} // if (keyIds.size)

if (tracksChanged) {
this.updateAbrManagerVariants_();
const variantsUpdated = this.updateAbrManagerVariants_();
if (!variantsUpdated) {
return;
}
}

const currentVariant = this.streamingEngine_.getCurrentVariant();
Expand Down

0 comments on commit 28d651b

Please sign in to comment.