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

Support ClearKey Encrypted HLS #34

Open
tiberiumihai opened this issue Oct 14, 2020 · 8 comments
Open

Support ClearKey Encrypted HLS #34

tiberiumihai opened this issue Oct 14, 2020 · 8 comments
Assignees
Labels
enhancement New feature or request safari Thank you, Apple. Very cool...

Comments

@tiberiumihai
Copy link

tiberiumihai commented Oct 14, 2020

Description

I've packaged encrypted media files into dash and hls using MP4Box using filters to generate both manifests (dash and hls) manifest.m3u8:dual. Dual filter was introduced in GPAC v0.9.0. More info about this here: https://github.com/gpac/testsuite/blob/filters/scripts/hls-gen.sh

vgDash is working great with ClearKey DRM but I'm stuck with Hls on Safari.

I'm using both dash and hls directives:

<video ... [vgDash]="video.dashManifest"
               [vgHls]="video.hlsManifest"
               [vgDRMToken]="video.token"
               [vgDRMLicenseServer]="video.licenseServers"><track ... /></video>

And I'm changing bitrates based on this value:

  get isHlsSupported() {
    const videoElement = this.videoPlayer?.nativeElement;
    const hlsSupported = videoElement && videoElement.canPlayType("application/vnd.apple.mpegurl");
    if (hlsSupported) {
      console.log("HLS SUPPORTED BROWSER");
    }
    return hlsSupported;
  }

I see that vgDRMToken and vgDRMLicenseServer are available only for vgDash.
Is there any other way to specify ClearKey for vgHls?

I've seen this comment (video-dev/hls.js#2901 (comment)) and I think ClearKey support will be introduced in hls.js@v1.0.0.

Expected Behavior

ClearKey Encrypted Hls to work.

Actual Behavior

Currently, the player, loads manifest.m3u8 playlist and associated segments, but can not decrypt and displays 00:00 video.

Steps to Reproduce

  1. Encrypt video and audio files
  2. Generate dash and hls manifest.m3u8:dual based on encrypted media
  3. Use [vgHls]="'http://localhost:/manifest.m3u8'"
  4. hls can not decrypt video stream. No errors in console though.

Attachments

HLS Supported in Safari

DASH Supported in Chrome

@tiberiumihai
Copy link
Author

tiberiumihai commented Oct 14, 2020

ClearKey support will be added into hls.js@v1.0.0
PR here: video-dev/hls.js#2934

Maybe we can add support for hls as well.
I can help with this once the PR is merged and released in hls.js.

@IxquitilisSaid IxquitilisSaid self-assigned this Oct 15, 2020
@IxquitilisSaid
Copy link
Member

Yeah for sure! I subscribed to the HLS PR so we can fix it as soon as it's merged 👀

@IxquitilisSaid
Copy link
Member

Pinging to prevent stale status
They sure do be taking their time to merge it...

@tiberiumihai
Copy link
Author

tiberiumihai commented Nov 17, 2020

Yes...

Update:
For my project I've ditched clear key support in favour of AES-128, and dash in favour of fragmented hls.
Safari doesn't support ClearKey anyway, and most major browsers would work with AES-128 fragmented hls, including Safari.
So, even if hls.js player is adding support for ClearKey, a ClearKey encrypted stream won't work in Safari (Web, iPhone or iPads).

@IxquitilisSaid
Copy link
Member

Thanks, Apple. Very cool... 🙄
Anyway... I glad you found a workaround for your project 😄 , as for the PR once it's merged I'll add support for it either way.
Hopefully, no one will try it on Safari

@tiberiumihai
Copy link
Author

If you need help, I can help as well, let me know. Thanks!

@IxquitilisSaid IxquitilisSaid added enhancement New feature or request safari Thank you, Apple. Very cool... labels Nov 17, 2020
@IxquitilisSaid
Copy link
Member

Aye! I'll ping you if something comes up
Thanks, once again! 😄

@naktinis
Copy link

naktinis commented Oct 8, 2021

Just mentioning this in case anyone else looks for this in the future. If I read it right, there's a recent WebKit ticket to move this forward on Safari – https://bugs.webkit.org/show_bug.cgi?id=231006.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request safari Thank you, Apple. Very cool...
Projects
None yet
Development

No branches or pull requests

3 participants