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 48d36b2 commit 0b03e79
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/player.js
Expand Up @@ -5679,7 +5679,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 0b03e79

Please sign in to comment.