Skip to content

Commit

Permalink
Reuse cache even if key system type given in API is not the same
Browse files Browse the repository at this point in the history
Thanks to the PR #1478, that basically allows integration tests on our
DRM logic without a real encrypted or decodable contents nor MSE/EME
available, I noticed that I very recently brought a minor regression in
the rewrite of the `MediaKeySystemAccess` cache reusage rules.

We relied on the `keySystems[].type` API to see if the cached one was
compatible to the new wanted one, we probably wanted to compare the
former with the `type` actually provided as argument to the
`navigator.requestMediaKeySystemAccess` API instead (e.g.
`keySystems[].type` could be set just to `widevine`, in which case the
RxPlayer will probably ask for `com.widevine.alpha` instead).

Thankfully, EME defines a
[`MediaKeySystemAccess.prototype.keySystem`](https://www.w3.org/TR/encrypted-media-2/#dom-navigator-requestmediakeysystemaccess)
property that seems to (according to that recommendation) always be equal
to the asked `keySystem`.
  • Loading branch information
peaBerberian committed Dec 23, 2024
1 parent e7277b1 commit 192bf78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main_thread/decrypt/find_key_system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ export default function getMediaKeySystemAccess(
currentState !== null &&
!shouldRenewMediaKeySystemAccess() &&
// TODO: Do it with MediaKeySystemAccess.prototype.keySystem instead?
keyType === currentState.keySystemOptions.type &&
keyType === currentState.mediaKeySystemAccess.keySystem &&
eme.implementation === currentState.emeImplementation.implementation &&
isNewMediaKeySystemConfigurationCompatibleWithPreviousOne(
keySystemConfiguration,
Expand Down

0 comments on commit 192bf78

Please sign in to comment.