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

Playlist with mixed segment with and without DRM (ClearKey) #4774

Closed
st-oka opened this issue Dec 1, 2022 · 11 comments
Closed

Playlist with mixed segment with and without DRM (ClearKey) #4774

st-oka opened this issue Dec 1, 2022 · 11 comments
Labels
component: HLS The issue involves Apple's HLS manifest format priority: P1 Big impact or workaround impractical; resolve before feature release status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@st-oka
Copy link

st-oka commented Dec 1, 2022

Have you read the Tutorials?
yes

Have you read the FAQ and checked for duplicate open issues?
yes

What version of Shaka Player are you using?
4.3.0

Please ask your question
I am trying SSAI using Google IMA DAI SDK for HTML5
When playing the playlist which main content (non-advertisement part) is encrypted with AES-128 and advertisement is not encrypted, I get the following error before mid-roll is played.
Screen Shot 2022-12-01 at 12 14 58

Also, if the playlist that neither of which is encrypted, can play mid-roll without any problem.
I assume that this issue is caused by the shaka-player not being able to handle the switching between encrypted (ClearKey in this case) and unencrypted segments.
Could you confirm my understanding is correct? Thank you in advance for your answer.

@st-oka st-oka added the type: question A question from the community label Dec 1, 2022
@joeyparrish
Copy link
Member

Switching between encrypted and unencrypted content in the player is a no-op. We don't do anything special. It is all handled by the browser's CDM and decoders.

@joeyparrish
Copy link
Member

Mixed encrypted/unencrypted content is extremely common, especially for server-side ad insertion. This structure should not be an issue. In fact, even without ads, some encrypted VOD content begins unencrypted for several seconds (called a "clear lead") to allow time for the license exchange without delaying startup.

Please check chrome://media-internals to see logs of what the browser is doing, and what errors are occurring at that level. That might give a clue that leads you to the root cause.

@st-oka
Copy link
Author

st-oka commented Dec 5, 2022

Thanks for sharing this useful information. I also understood that mixed encrypted/unencrypted content is extremely common.
I checked chrome://media-internals, and indeed this gives more information about player's behavior, but it didn't seem to help with this issue.
I've attached a screenshot of what I tried, could you think of anything that might have caused it from these?
(There is an error at the last event "kPause" in the first file)

FireShot Capture 465 - Media Internals - media-internals
FireShot Capture 465 - Media Internals - media-internals2
FireShot Capture 465 - Media Internals - media-internals3

@joeyparrish
Copy link
Member

(There is an error at the last event "kPause" in the first file)

I don't see it. In the first screenshot, kPause is the last event shown.

After re-reading your issue, I noticed something inconsistent that we should clarify. Are you using ClearKey (which is an open, demo DRM system)? Or HLS's AES-128 (which uses clear keys, but not ClearKey DRM)? There is an important distinction, and they have to be implemented in completely different ways in the player.

@st-oka
Copy link
Author

st-oka commented Dec 16, 2022

I am not sure of the difference between ClearKey and clear keys, sorry if I am confusing you because the title and body content do not match. I am using HLS's AES-128.

@joeyparrish
Copy link
Member

It's pretty confusing.

AES-128 is a block cipher, and there are many "modes" in which you can use it, by combining it with other operations in some kind of chain, or by feeding it with certain data.

All standardized DRM (the "Common Encryption" standard) uses AES-128 at its core, in one of two common modes (CTR or CBCS). However, the "AES-128" encryption used by Apple in HLS is incompatible with all of those DRM schemes. It uses CBC mode, but encrypts the entire segment instead of just parts of it. It's also not considered DRM. What makes it harder to understand is that Apple's FairPlay DRM uses Common Encryption, not the encryption they describe in HLS.

All DRM uses the EME API in the browser. Encryption and key requests are handled inside the browser in something called a CDM (Content Decryption Module). Apple's FairPlay, Goggle's Widevine, and Microsoft's Play ready are all DRM. ClearKey DRM is not "real" DRM because the keys are in the clear, but it is handled by a CDM and uses the same decryption as the other DRM systems.

HLS's "AES-128" encrypts the entire segment (unlike DRM), so the CDM can't decrypt it. Even the ClearKey CDM is incompatible with this. So this content is decrypted using WebCrypto APIs in JavaScript.

I'm going to assume you're using HLS's AES-128 full-segment encryption. So what might be happening is that the player is decrypting a clear ad with the key for the previous main content. Then what gets fed to the browser for that ad is random-looking garbage, and it fails to decode.

Can you please provide an accessible playlist URL for us to debug? I'll relabel this as a bug. Thanks!

@joeyparrish joeyparrish added type: bug Something isn't working correctly component: HLS The issue involves Apple's HLS manifest format priority: P1 Big impact or workaround impractical; resolve before feature release and removed type: question A question from the community labels Dec 16, 2022
@github-actions github-actions bot added this to the v4.4 milestone Dec 16, 2022
@avelad avelad assigned avelad and unassigned avelad Dec 20, 2022
@st-oka
Copy link
Author

st-oka commented Dec 20, 2022

Thank you for your uncomplicated explanation.

Please use the following assekey for your debugging playlist: nXpWfyUlSp6KB7JEiB0dnQ
We will try to keep it running until this week for once as our encoder resources are limited.

@avelad
Copy link
Member

avelad commented Dec 20, 2022

@st-oka is the issue the same as #4846? Can you check if the PR (#4847) resolves your problem ?

@avelad
Copy link
Member

avelad commented Jan 9, 2023

Can you check with the main branch?

@avelad avelad added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jan 9, 2023
@github-actions
Copy link
Contributor

Closing due to inactivity. If this is still an issue for you or if you have further questions, the OP can ask shaka-bot to reopen it by including @shaka-bot reopen in a comment.

@github-actions github-actions bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jan 16, 2023
@avelad avelad removed this from the v4.4 milestone Jan 16, 2023
@st-oka
Copy link
Author

st-oka commented Jan 18, 2023

@shaka-bot reopen

I've confirmed that this problem no longer occurs.

@github-actions github-actions bot reopened this Jan 18, 2023
@github-actions github-actions bot added this to the v4.4 milestone Jan 18, 2023
@avelad avelad closed this as completed Jan 18, 2023
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Mar 19, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: HLS The issue involves Apple's HLS manifest format priority: P1 Big impact or workaround impractical; resolve before feature release status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

3 participants