Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compat): on Edge test comprehensively KeySystems before considering them as usable #1434

Merged
merged 6 commits into from
May 15, 2024

Conversation

Florent-Bouisset
Copy link
Collaborator

We observed that the RxPlayer cannot trust the browser when it has successfully granted the MediaKeySystemAccess with
navigator.requestMediaKeySystemAccess(keySystem) function, and it should do some additional testing to confirm that the keySystem is supported on the device.

This behavior has been experienced on the following device:

On a Microsoft Surface with Edge v.124:

  • Althought requestMediaKeySystemAccess resolve correctly with the keySystem "com.microsoft.playready.recommendation.3000", generating a request with generateRequest throws an error: "NotSupportedError: Failed to execute 'generateRequest' on 'MediaKeySession': Failed to create MF PR CdmSession".
    In this particular case, the work-around was to consider recommendation.3000 as not supported and try another keySystem.

@Florent-Bouisset Florent-Bouisset added DRM Relative to DRM (EncryptedMediaExtensions) Compatibility Relative to the RxPlayer's compatibility with various devices and environments labels Apr 29, 2024
@Florent-Bouisset Florent-Bouisset force-pushed the fix/compatibilty-edge-test-keysystems branch from 5dd6167 to e78c575 Compare April 29, 2024 12:56
@Florent-Bouisset Florent-Bouisset force-pushed the fix/compatibilty-edge-test-keysystems branch from af66177 to 4528c5a Compare April 30, 2024 09:51
@Florent-Bouisset Florent-Bouisset force-pushed the fix/compatibilty-edge-test-keysystems branch from 4528c5a to 791ec0e Compare April 30, 2024 09:58
@peaBerberian
Copy link
Collaborator

LGTM

Did you test the last iteration on one device that was problematic and another based on Edge-chromium that wasn't? (Just so we ensure this fixes the issue and doesn't break PlayReady devices where it is unnecessary?)

@Florent-Bouisset
Copy link
Collaborator Author

LGTM

Did you test the last iteration on one device that was problematic and another based on Edge-chromium that wasn't? (Just so we ensure this fixes the issue and doesn't break PlayReady devices where it is unnecessary?)

Not yet, will do when I have the devices in hands

@Florent-Bouisset
Copy link
Collaborator Author

I have tested it on a problematic device and another one that is OK. It behaved as expected

@peaBerberian peaBerberian added this to the 4.1.0 milestone May 15, 2024
@peaBerberian peaBerberian merged commit 6f68baf into dev May 15, 2024
4 of 6 checks passed
peaBerberian added a commit that referenced this pull request Jul 23, 2024
Another day, another PlayReady-specific issue :/

A partner signalled to us that they weren't able to play a mix of
unencrypted and encrypted content on any PlayReady devices.

After investigation, it seems that calling `generateRequest` for the
first time after clear segments are already present on a MSE
`SourceBuffer` associated to the MediaSource linked to the
corresponding media element immediately triggered an HTML5
`MEDIA_ERR_DECODE` error.

We tried A LOT of work-arounds:

  - patching clear segments with a `tenc` box with a `0x0` key id to
    incite the CDM to understand that encrypted contents may be pushed
    in the future

  - Rewriting the pssh sent through the EME `generateRequest` API so
    that it is barebone to limit weird PlayReady edge cases.

  - Replacing those stream clear segments' with those in our demo page,
    just to check that the clear segments were not at fault here

  - Waiting more time between the association of a MediaKeys to the
    media element and pushing the first segments.

None of those actions had an effect.

However, what had an effect, was to call the `generateRequest` API
BEFORE buffering any segment yet AFTER attaching the MediaKeys (and
perhaps MediaSource) to the media element.

So this commit does just that, communicating dummy initialization data
for a session that will be closed directly after.

Note that we already do a fake `generateRequest` on Edge Chromium with
Playready since #1434, yet this test was not sufficient, seemingly
because it is performed BEFORE MediaKeys attachment.

Note that this commit fixes the clear -> encrypted issues our partner
were having, but we're unsure yet of if it fixes the encrypted -> clear
issues (and I have good reasons to think it does not).

So, uh, yeah, PlayReady seems to keep being hard-at-work giving us
challenges and head-scratchers.
peaBerberian added a commit that referenced this pull request Jul 23, 2024
Another day, another PlayReady-specific issue :/

A partner signalled to us that they weren't able to play a mix of
unencrypted and encrypted content on any PlayReady devices.

After investigation, it seems that calling `generateRequest` for the
first time after clear segments are already present on a MSE
`SourceBuffer` associated to the MediaSource linked to the
corresponding media element immediately triggered an HTML5
`MEDIA_ERR_DECODE` error.

We tried A LOT of work-arounds:

  - patching clear segments with a `tenc` box with a `0x0` key id to
    incite the CDM to understand that encrypted contents may be pushed
    in the future

  - Rewriting the pssh sent through the EME `generateRequest` API so
    that it is barebone to limit weird PlayReady edge cases.

  - Replacing those stream clear segments' with those in our demo page,
    just to check that the clear segments were not at fault here

  - Waiting more time between the association of a MediaKeys to the
    media element and pushing the first segments.

None of those actions had an effect.

However, what had an effect, was to call the `generateRequest` API
BEFORE buffering any segment yet AFTER attaching the MediaKeys (and
perhaps MediaSource) to the media element.

So this commit does just that, communicating dummy initialization data
for a session that will be closed directly after.

Note that we already do a fake `generateRequest` on Edge Chromium with
Playready since #1434, yet this test was not sufficient, seemingly
because it is performed BEFORE MediaKeys attachment.

Note that this commit fixes the clear -> encrypted issues our partner
were having, but we're unsure yet of if it fixes the encrypted -> clear
issues (and I have good reasons to think it does not).

So, uh, yeah, PlayReady seems to keep being hard-at-work giving us
challenges and head-scratchers.
peaBerberian added a commit that referenced this pull request Jul 23, 2024
Another day, another PlayReady-specific issue :/

A partner signalled to us that they weren't able to play a mix of
unencrypted and encrypted content on any PlayReady devices.

After investigation, it seems that calling `generateRequest` for the
first time after clear segments are already present on a MSE
`SourceBuffer` associated to the MediaSource linked to the
corresponding media element immediately triggered an HTML5
`MEDIA_ERR_DECODE` error.

We tried A LOT of work-arounds:

  - patching clear segments with a `tenc` box with a `0x0` key id to
    incite the CDM to understand that encrypted contents may be pushed
    in the future

  - Rewriting the pssh sent through the EME `generateRequest` API so
    that it is barebone to limit weird PlayReady edge cases.

  - Replacing those stream clear segments' with those in our demo page,
    just to check that the clear segments were not at fault here

  - Waiting more time between the association of a MediaKeys to the
    media element and pushing the first segments.

None of those actions had an effect.

However, what had an effect, was to call the `generateRequest` API
BEFORE buffering any segment yet AFTER attaching the MediaKeys (and
perhaps MediaSource) to the media element.

So this commit does just that, communicating dummy initialization data
for a session that will be closed directly after.

Note that we already do a fake `generateRequest` on Edge Chromium with
Playready since #1434, yet this test was not sufficient, seemingly
because it is performed BEFORE MediaKeys attachment.

Note that this commit fixes the clear -> encrypted issues our partner
were having, but we're unsure yet of if it fixes the encrypted -> clear
issues (and I have good reasons to think it does not).

So, uh, yeah, PlayReady seems to keep being hard-at-work giving us
challenges and head-scratchers.
peaBerberian added a commit that referenced this pull request Jul 23, 2024
Another day, another PlayReady-specific issue :/

A partner signalled to us that they weren't able to play a mix of
unencrypted and encrypted content on any PlayReady devices.

After investigation, it seems that calling `generateRequest` for the
first time after clear segments are already present on a MSE
`SourceBuffer` associated to the MediaSource linked to the
corresponding media element immediately triggered an HTML5
`MEDIA_ERR_DECODE` error.

We tried A LOT of work-arounds:

  - patching clear segments with a `tenc` box with a `0x0` key id to
    incite the CDM to understand that encrypted contents may be pushed
    in the future

  - Rewriting the pssh sent through the EME `generateRequest` API so
    that it is barebone to limit weird PlayReady edge cases.

  - Replacing those stream clear segments' with those in our demo page,
    just to check that the clear segments were not at fault here

  - Waiting more time between the association of a MediaKeys to the
    media element and pushing the first segments.

None of those actions had an effect.

However, what had an effect, was to call the `generateRequest` API
BEFORE buffering any segment yet AFTER attaching the MediaKeys (and
perhaps MediaSource) to the media element.

So this commit does just that, communicating dummy initialization data
for a session that will be closed directly after.

Note that we already do a fake `generateRequest` on Edge Chromium with
Playready since #1434, yet this test was not sufficient, seemingly
because it is performed BEFORE MediaKeys attachment.

Note that this commit fixes the clear -> encrypted issues our partner
were having, but we're unsure yet of if it fixes the encrypted -> clear
issues (and I have good reasons to think it does not).

So, uh, yeah, PlayReady seems to keep being hard-at-work giving us
challenges and head-scratchers.
peaBerberian added a commit that referenced this pull request Jul 23, 2024
Another day, another PlayReady-specific issue :/

A partner signalled to us that they weren't able to play a mix of
unencrypted and encrypted content on any PlayReady devices.

After investigation, it seems that calling `generateRequest` for the
first time after clear segments are already present on a MSE
`SourceBuffer` associated to the MediaSource linked to the
corresponding media element immediately triggered an HTML5
`MEDIA_ERR_DECODE` error.

We tried A LOT of work-arounds:

  - patching clear segments with a `tenc` box with a `0x0` key id to
    incite the CDM to understand that encrypted contents may be pushed
    in the future

  - Rewriting the pssh sent through the EME `generateRequest` API so
    that it is barebone to limit weird PlayReady edge cases.

  - Replacing those stream clear segments' with those in our demo page,
    just to check that the clear segments were not at fault here

  - Waiting more time between the association of a MediaKeys to the
    media element and pushing the first segments.

None of those actions had an effect.

However, what had an effect, was to call the `generateRequest` API
BEFORE buffering any segment yet AFTER attaching the MediaKeys (and
perhaps MediaSource) to the media element.

So this commit does just that, communicating dummy initialization data
for a session that will be closed directly after.

Note that we already do a fake `generateRequest` on Edge Chromium with
Playready since #1434, yet this test was not sufficient, seemingly
because it is performed BEFORE MediaKeys attachment.

Note that this commit fixes the clear -> encrypted issues our partner
were having, but we're unsure yet of if it fixes the encrypted -> clear
issues (and I have good reasons to think it does not).

So, uh, yeah, PlayReady seems to keep being hard-at-work giving us
challenges and head-scratchers.
peaBerberian added a commit that referenced this pull request Jul 23, 2024
Another day, another PlayReady-specific issue :/

A partner signalled to us that they weren't able to play a mix of
unencrypted and encrypted content on any PlayReady devices.

After investigation, it seems that calling `generateRequest` for the
first time after clear segments are already present on a MSE
`SourceBuffer` associated to the MediaSource linked to the
corresponding media element immediately triggered an HTML5
`MEDIA_ERR_DECODE` error.

We tried A LOT of work-arounds:

  - patching clear segments with a `tenc` box with a `0x0` key id to
    incite the CDM to understand that encrypted contents may be pushed
    in the future

  - Rewriting the pssh sent through the EME `generateRequest` API so
    that it is barebone to limit weird PlayReady edge cases.

  - Replacing those stream clear segments' with those in our demo page,
    just to check that the clear segments were not at fault here

  - Waiting more time between the association of a MediaKeys to the
    media element and pushing the first segments.

None of those actions had an effect.

However, what had an effect, was to call the `generateRequest` API
BEFORE buffering any segment yet AFTER attaching the MediaKeys (and
perhaps MediaSource) to the media element.

So this commit does just that, communicating dummy initialization data
for a session that will be closed directly after.

Note that we already do a fake `generateRequest` on Edge Chromium with
Playready since #1434, yet this test was not sufficient, seemingly
because it is performed BEFORE MediaKeys attachment.

Note that this commit fixes the clear -> encrypted issues our partner
were having, but we're unsure yet of if it fixes the encrypted -> clear
issues (and I have good reasons to think it does not).

So, uh, yeah, PlayReady seems to keep being hard-at-work giving us
challenges and head-scratchers.
peaBerberian added a commit that referenced this pull request Jul 23, 2024
Another day, another PlayReady-specific issue :/

A partner signalled to us that they weren't able to play a mix of
unencrypted and encrypted content on any PlayReady devices.

After investigation, it seems that calling `generateRequest` for the
first time after clear segments are already present on a MSE
`SourceBuffer` associated to the MediaSource linked to the
corresponding media element immediately triggered an HTML5
`MEDIA_ERR_DECODE` error.

We tried A LOT of work-arounds:

  - patching clear segments with a `tenc` box with a `0x0` key id to
    incite the CDM to understand that encrypted contents may be pushed
    in the future

  - Rewriting the pssh sent through the EME `generateRequest` API so
    that it is barebone to limit weird PlayReady edge cases.

  - Replacing those stream clear segments' with those in our demo page,
    just to check that the clear segments were not at fault here

  - Waiting more time between the association of a MediaKeys to the
    media element and pushing the first segments.

None of those actions had an effect.

However, what had an effect, was to call the `generateRequest` API
BEFORE buffering any segment yet AFTER attaching the MediaKeys (and
perhaps MediaSource) to the media element.

So this commit does just that, communicating dummy initialization data
for a session that will be closed directly after.

Note that we already do a fake `generateRequest` on Edge Chromium with
Playready since #1434, yet this test was not sufficient, seemingly
because it is performed BEFORE MediaKeys attachment.

Note that this commit fixes the clear -> encrypted issues our partner
were having, but we're unsure yet of if it fixes the encrypted -> clear
issues (and I have good reasons to think it does not).

So, uh, yeah, PlayReady seems to keep being hard-at-work giving us
challenges and head-scratchers.
peaBerberian added a commit that referenced this pull request Jul 23, 2024
Another day, another PlayReady-specific issue :/

A partner signalled to us that they weren't able to play a mix of
unencrypted and encrypted content on any PlayReady devices.

After investigation, it seems that calling `generateRequest` for the
first time after clear segments are already present on a MSE
`SourceBuffer` associated to the MediaSource linked to the
corresponding media element immediately triggered an HTML5
`MEDIA_ERR_DECODE` error.

We tried A LOT of work-arounds:

  - patching clear segments with a `tenc` box with a `0x0` key id to
    incite the CDM to understand that encrypted contents may be pushed
    in the future

  - Rewriting the pssh sent through the EME `generateRequest` API so
    that it is barebone to limit weird PlayReady edge cases.

  - Replacing those stream clear segments' with those in our demo page,
    just to check that the clear segments were not at fault here

  - Waiting more time between the association of a MediaKeys to the
    media element and pushing the first segments.

None of those actions had an effect.

However, what had an effect, was to call the `generateRequest` API
BEFORE buffering any segment yet AFTER attaching the MediaKeys (and
perhaps MediaSource) to the media element.

So this commit does just that, communicating dummy initialization data
for a session that will be closed directly after.

Note that we already do a fake `generateRequest` on Edge Chromium with
Playready since #1434, yet this test was not sufficient, seemingly
because it is performed BEFORE MediaKeys attachment.

Note that this commit fixes the clear -> encrypted issues our partner
were having, but we're unsure yet of if it fixes the encrypted -> clear
issues (and I have good reasons to think it does not).

So, uh, yeah, PlayReady seems to keep being hard-at-work giving us
challenges and head-scratchers.
@peaBerberian peaBerberian deleted the fix/compatibilty-edge-test-keysystems branch July 26, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compatibility Relative to the RxPlayer's compatibility with various devices and environments DRM Relative to DRM (EncryptedMediaExtensions)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants