fix: DrmEngine exception thrown when using FairPlay #4971
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #4902
This is not intended to be a complete fix for the issue, I do not understand the effect this new ternary on the shaka player as a whole. I have not found the root cause for
this.currentDrmInfo_
beingundefined
when accessed. It does, however, look like it has previously been acceptable for this property to beundefined
. I opened this PR more as a point of discussion around the issue at hand.During the work to add Fairplay support in 2022, accessing
this.currentDrmInfo_
was added on line 483. This line does not accept thatthis.currentDrmInfo_
can be undefined. A few lines below this,this.createOrLoad()
is called, which does accept thatthis.currentDrmInfo_
can beundefined
. The latter piece of code was last modified in 2019.shaka-player/lib/media/drm_engine.js
Lines 483 to 498 in c471d23
shaka-player/lib/media/drm_engine.js
Lines 626 to 629 in c471d23