-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
PlayReady EME "encrypted" PSSH initData payload ignored #6005
Comments
Hi @jrivany, Are you providing the correct KEY tags in your HLS playlists? The That being said, I'd be happy to review and test changes that could support additional configurations. |
Hey Rob, thanks for the quick reply.
In this instance no. I should provide more context: we're currently writing our own packaging layer, and were experimenting with the viability of different options. In this particular experiment I was casually ignoring 4.4.4.4 in the spec, specifically:
In theory there was no technical reason we couldn't rely solely on the PSSH box in the content itself, which currently works fine when there's only a single PSSH box. This is definitely a more fringe, off-spec use-case that would only be a mild simplification on the manifest generation side, which I'm now reconsidering the value of. |
For clear-lead playlists where the pssh is in the init segment, but the first segment or two are not encrypted, CDM setup can begin in response to appending the init segment and EME dispatching the "encrypted" event. In this example, the pssh is present in "init.mp4", but first encrypted segment is "s3.mp4":
If HLS.js didn't begin the key session on the "encrypted" event, it would not begin until just before loading the third segment - something to consider if you packaging media this way with more than one key system or multiple keys in the init segment. Thanks for sharing the eme-initdata-cenc/#format details. I don't implement features without sample assets which is why this one only made it so far. I look forward to hearing which way you go. |
Hey there @robwalch this actually showed up as an issue for us with multi-drm (widevine + playready pssh'es). We have an "in-app" (aka in the core of Mux Player) solution that accounts for it here muxinc/elements#957, but I'm hoping to dig in and see if there might be some assumptions to unwind in e.g. the mp4 -> mp4 transmuxing. Happy to share test content out of band if you wanna dig in as well. |
Have a look at
hls.js/src/controller/eme-controller.ts Lines 675 to 718 in cedf96d
It would help to know which of these you are encountering. Please also have a look at the |
For ArrayBuffer/Uint8Arrat type issues please thumbs up or comment on #5849. |
will follow up in more detail but the tl;dr:
|
For pssh extraction (from playlist KEY data URI) see
The |
perfect will pull these threads. Thanks, @robwalch! |
The description of this issue points to code that only handles PSSH found in Widevine and PlayReady KEY tags (which should not include PSSH data from other key-systems).
That is the expected behavior. |
I think what's going on (@jrivany and maybe @cjpillsbury although not sure about the nesting issue) is you want Is this required on a specific UA or by your license server? |
@robwalch |
ah actually looks like this is, in fact, from the pssh generated by the EXT-X-KEY URI. We're b64 encoding the full pssh. and it looks like
|
Yeah being able to effectively filter in/out based on where the key is sourced from, I think that would be a solid improvement (now that I've gotten my bearings on root cause in this case) |
fwiw just confirmed this minor change to
current code, for reference: |
Right. So you should have a log message that looks like:
Base64 encoding is expected for PlayReady. The encoded data is expected to be a PlayReady Object.
There was a patch (#5699) that went in that perhaps belonged in hls.js/src/controller/eme-controller.ts Lines 974 to 1012 in 6ef8363
The "Challenge" (the pssh payload) must be parsed from the PlayReady Object to create a valid PSSH that will then be supplied as initData. It looks like (#5699) worked around this by detecting the xml content and parsing the challenge out just before sending the data to the license server. The correct place to do this would be in |
We went ahead and updated our
As expected, the PlayReady (identified via its Widevine also conforms in relevant ways, but it did not have any issues, so I'll not dive in on that one.
(Real world example no longer available bc we updated our servers. Below is the updated implementation that is consistent with hls.js's assumptions)
Since we've changed our implementation server-side (and since we also identified a workaround client side via config), none of this is urgent for me/us. I'm just noting a few places that resulted in some pain on our side that could plausibly be improved by unwinding some in-code assumptions that should arguably be loosened (or at least conditionalized, per my quick/hack example code change ☝️). |
It should be a PlayReady Object. The fact that The proposed solution for the bug in hls.js is to extract the pssh data (the 'Challenge' element) from the PRO. This can be achieved by moving the code from I suggest using a How does that sound? Would you be willing to contribute a fix for this, or would you prefer I make a PR? If so, would you help test the fix? We would be careful to maintain compatibility with either type of data in the KEY tag based on whether or not the base64 decoded data includes PRO XML or the expected system ID bytes. |
I'm 💯 cool with working on a PR here, but I want to make sure there's alignment first.
I'm arguing that hls.js probably shouldn't assume (or at least should reduce the number of assumptions) that the |
I think we're in alignment. What I am saying is HLS.js should expect a PRO but account for when it is not. |
There are a couple of other points we should align on:
|
Aligned on both. I'll open another issue. Sorry for misappropriating/coopting your issue, @jrivany ! |
No worries - It could be the same root cause with a similar conclusion. (Although I think there is a point to be made with this issue about how to handle and document initData from "encrypted" events vs KEY tags.) If you need this as a patch please make changes against patch/v1.5.x. I'm happy to cut a patch and merge the fix into dev as a follow up. |
Related with workarounds suggested to filter session generation based on playlist or "encypted" event keys: #6636 |
Renamed this issue for comments above: #6005 (comment) PSSH parsing of initData was part of the problem, but that parsing was only for Widevine so that hls.js could initialize a session on clear segments with pssh payloads prior to requesting segments with KEY URIs in the playlist (see shaka-packager "clear-lead" example). #6640 will fix PSSH parsing with multi-key-system assets, but will continue to ignore PlayReady keys in the media. |
Is your feature request related to a problem? Please describe.
I'm looking at supporting media encrypted with multiple DRM systems (i.e. playready, widevine), in doing so I've generated MP4 init segments containing 2 PSSH boxes.
Currently the PSSH parsing code that handles the initData payload is written to assume there is only one PSSH box being passed:
https://github.com/video-dev/hls.js/blob/master/src/utils/mp4-tools.ts#L1300
However the CENC initialization data spec states that this could be multiple boxes concatenated:
https://www.w3.org/TR/eme-initdata-cenc/#format
Describe the solution you'd like
I would like if the EME constroller could support media that contains multiple adjacent PSSH boxes for different key systems.
Additional context
No response
The text was updated successfully, but these errors were encountered: