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

feat: Add limited support for HLS "identity" key format #4451

Merged
merged 4 commits into from
Aug 30, 2022

Conversation

joeyparrish
Copy link
Member

This feature is not entirely automatic.

The ClearKey CDM requires a key-id to key mapping. HLS doesn't
provide a key ID anywhere. So although we could use the 'URI'
attribute to fetch the actual 16-byte key, without a key ID, we can't
provide this automatically to the ClearKey CDM.

Instead, the application will have to use
player.configure('drm.clearKeys', { ... }) to provide the key IDs
and keys or player.configure('drm.servers.org\.w3\.clearkey', ...)
to provide a ClearKey license server URI.

Closes #2146

This feature is not entirely automatic.

The ClearKey CDM requires a key-id to key mapping.  HLS doesn't
provide a key ID anywhere.  So although we could use the 'URI'
attribute to fetch the actual 16-byte key, without a key ID, we can't
provide this automatically to the ClearKey CDM.

Instead, the application will have to use
`player.configure('drm.clearKeys', { ... })` to provide the key IDs
and keys or `player.configure('drm.servers.org\.w3\.clearkey', ...)`
to provide a ClearKey license server URI.

Closes shaka-project#2146
@avelad avelad added type: enhancement New feature or request component: HLS The issue involves Apple's HLS manifest format labels Aug 29, 2022
@avelad avelad added this to the v4.3 milestone Aug 29, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Aug 29, 2022

Incremental code coverage: 88.00%

Really a compiler issue, since we were ever able to omit keyId in the library before
@avelad
Copy link
Collaborator

avelad commented Aug 30, 2022

@joeyparrish Looking at the hls.js code, it looks like they make it custom (https://github.com/video-dev/hls.js/blob/master/src/demux/sample-aes.ts) . This change is fine, but it won't get much use since the key IDs won't be known in advance. On the other hand in Safari clearKey does not work correctly: https://bugs.webkit.org/show_bug.cgi?id=231006

Doubt, if we analyze the TS, could the keyID be obtained?

@joeyparrish
Copy link
Member Author

I'm very hesitant to implement sample decryption in JavaScript, in particular since we are mainly concerned with DRM, and identity key format isn't any kind of realistic content protection. So I tend to feel that this is good enough given the limited usefulness of identity keys, and will let people do some pre-DRM testing in Firefox, Chrome, and Edge. And in Safari, native HLS should support this, as well, even without ClearKey, right?

On the other hand, I'll admit now that nearly every time I've ever said "we shouldn't have to do X in JavaScript", we eventually reversed that decision and did it anyway. So who knows if someone will come along and make a strong case for it.

For now, though, let's stick with this very simple version and see what people have to say about it.

@joeyparrish joeyparrish merged commit b1e81a6 into shaka-project:main Aug 30, 2022
@joeyparrish joeyparrish deleted the hls-keyformat-identity branch August 30, 2022 18:49
@avelad
Copy link
Collaborator

avelad commented Aug 30, 2022

OK, thanks @joeyparrish

echoy-harmonicinc pushed a commit to harmonicinc-com/shaka-player that referenced this pull request Dec 6, 2022
…t#4451)

This feature is not entirely automatic.

The ClearKey CDM requires a key-id to key mapping.  HLS doesn't
provide a key ID anywhere.  So although we could use the 'URI'
attribute to fetch the actual 16-byte key, without a key ID, we can't
provide this automatically to the ClearKey CDM.

Instead, the application will have to use
`player.configure('drm.clearKeys', { ... })` to provide the key IDs
and keys or `player.configure('drm.servers.org\.w3\.clearkey', ...)`
to provide a ClearKey license server URI.

Closes shaka-project#2146
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Jul 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 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 status: archived Archived and locked; will not be updated type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support HLS identity key format
2 participants