-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Safari Fairplay MediaKeys Polyfill #382
Comments
What I meant by that comment is that we have never seen any Fairplay-compatible DASH content we could try in Shaka, nor any EME-based Fairplay demos using HLS. So we can only assume Apple's EME works. Can you share a link to something of that sort? A quick check shows that Safari 9's EME is the webkit-prefixed v0.1b API. The polyfill for that was originally developed against Chrome, but Chrome has long-since implemented the unprefixed working-draft EME API. If we need to modify the polyfill to better support Safari, I have no problems with that. Safari is, at the moment, the only known consumer of it. |
We have a server issue to resolve but then I should be able to provide you with a working Safari sample with HLS Fairplay content. |
I'm still working on getting you some HLS + Fairplay samples to give you. But there is sample client code from apple here: https://developer.apple.com/streaming/fps/ if you download the FairPlay Streaming Server SDK. If you haven't looked at this it would be useful for comparing to the v01b polyfill. For instance, for FPS on Safari the init data is formed by concatenating the After that it looks like there are some other differences. The concatenated init data is passed in the It appears to me that the flow on Safari is a bit different than on Chrome. I have tested that Apple sample code with HLS + Fairplay content and it does work in Safari. I'm also having the following issue in Safari: In
I'm not sure you'd want to handle it like this just for consistency reasons but this was how I could get around that error just for POC purposes. |
@joeyparrish would it help if I provide some test content to run against? |
@sarge, it couldn't hurt! Thanks! |
Hi there - we are now also finally under Pressure to run a DRM Solution for Safari asap. |
@joeyparrish I have uploaded a working sample of the fairplay drm. This file contains reference to the "Apple Developer Program License Agreement", so you can choose not to view it. Not sure what to do about worlds colliding here (shrug) @boredom2 HLS + Fairplay works on Safari Desktop. But does not work on Safari iOS, an app is still required. |
Thanks for that Information - I will try once SHAKA can handle the slightly "crippled" HLS Manifest, that we get from MS Azure CDN. I will update then here :) |
Here's an update on our progress. The polyfill part is not that difficult. I have written a polyfill that builds a compliant MediaKeys API on top of Safari 10's WebKitMediaKeys. Parsing the FairPlay tag in HLS to feed EME is trivial. The challenge is that the key system Judging from a WebKit commit log, they introduced
I have not been able to find any working examples of that key system in use. Creating a session with Dealing with this certificate request is enough to do, and we can even hide it in the MediaKeys polyfill. However, the message we get after that is not a license request, either. It's completely empty. WebKit sources also show support for |
Thanks Joey for taking a look at this. You got further than I did. Would you mind pushing a branch?
When you say after the certificate request you get a message that is empty do you mean that get a call to |
I mean that the second |
I can't push anything until it's been through code review by the team, but I'll try to clean up what I've done so far and make it available in some form. |
Since this unprefixed API is dependent on a specific OS version, I think it's best if I continue developing the polyfill to support older OS versions. Then I'll perform the update to Mojave and test again. :-) |
Yeah, used to try, but there is also no way to detect fireplay with |
If that's the case, we'll be stuck using prefixed until Apple implements the whole thing. I'll find out soon. Probably tomorrow. |
A teammate has confirmed that requestMediaKeySystemAccess is available on Safari 12.1 on Mojave specifically. It's not on 12.1 on High Sierra. |
Using a custom server certificate, starting playback, then reloading the demo app was resulting in the cert field being lost. This ensures that the server cert is always preserved across reloads. Very useful while working on #382 Change-Id: If1b65b1f24e21ce27cb3a54b5862b2b700b23ac1
Thank you @avelad for the content. My changes are still in review, but I have your content working with Apple's HLS and If anyone else has sample content to contribute, please send them our way! |
This shouldn't depend on the load state. Issue #382 Change-Id: Ia601c79404e074ec080c923f239533a8d04f6e64
Allow indirect access to members (such as DRM engine, manifest, etc) from Player methods as soon as they become available, instead of waiting until the very end of the load process. This fixes application access to several methods during the "manifestparsed" event. The point of the "manifestparsed" event was to allow early access to manifest and other metadata before streaming begins. This also lays the foundations for improvements in native HLS support in those same methods, including the ability to get track information. Issue #382 Issue #997 Fixes b/131604508 Change-Id: Ifee7b06fc2ccdcf5bcdf1c44f2f851d1d7e67fa1
I sent a link with some TIDAL sample content to [email protected] now, would be great if you can test that! |
Will do! Thank you! |
Track methods are now implemented for native HLS and other src= playbacks. This will allow the UI to select text and audio languages. This change adds best-effort methods to get track information for src= playbacks, including native HLS on Safari. In many cases, it relies on the audioTracks and videoTracks members of HTMLVideoElement which are only implemented on Safari. They are in the spec, though, so there's no harm in using them when they exist. This is fully parallel to the manifest-based paradigm for MSE-based playbacks. Each of these top-level methods in Player has an "if" to decide which way to supply the requested info, except for the language methods, which now delegate to the track methods. With this, Safari's native HLS can supply audio and text language information to the UI/app, and the UI/app can have some control over those things through the tracks API. I believe this is important to the success of our new iOS support. Issue #997 Issue #382 Change-Id: Icc44a932927fafedda1b62a9d4c6e2ed3dc7db30
This adds a polyfill for Apple's prefixed EME implementation. This will be used on all macOS versions prior to 10.14 (Mojave) and on Safari versions prior to 12.1. This also adds support for FairPlay license protocol eccentricities in DrmEngine, so that the proper formatting is used for requests and responses. Issue #382 Change-Id: If1274d2f018a475f56c09df97645694f13acbde9
The unprefixed EME launched with macOS 10.14 (Mojave) rejects requests for the key system IDs we know how to use. So until the bug we filed against Apple is resolved, prefer the prefixed API. Issue #382 Change-Id: I71313be2102af2da66a6389a9e9afdebd8ae033d
@joeyparrish Can you update README.md file with current Fairplay status? |
Yes, thanks for reminding me! |
Issue #382 Change-Id: I85279100052c3eedd46912e74448cd29268e8632
I'm trying to implement Fairplay with new shaka-player version (2.5) ? Can you update documentation to include configuration for Fairplay ? |
Sure. In the mean time, here's what you need to know. You use FairPlay just like any other DRM in terms of the license server config: player.configure({
drm: {
servers: {
'com.apple.fps.1_0': '/path/to/my/server',
},
},
});
// or
player.configure('drm.servers.com\\.apple\\.fps\\.1_0', '/path/to/my/server'); In addition, FairPlay requires you to provide a certificate through the "advanced" DRM config: const response = await fetch('/path/to/my/cert.der');
if (!response.ok) {
// handle error
}
const cert = await response.arrayBuffer();
player.configure({
drm: {
advanced: {
'com.apple.fps.1_0': {
serverCertificate: new Uint8Array(cert),
},
},
},
});
// or
player.configure('drm.advanced.com\\.apple\\.fps\\.1_0.serverCertificate',
new Uint8Array(cert)); If your license server doesn't use the default formatting for FairPlay license requests/responses, you can use request and response filters to transform them. See the "License Wrapping" tutorials for generic examples of that. I hope that helps you get started. We'll work on improving the docs around FairPlay so that these things are clearer. |
@joeyparrish I'm so excited about this. Been waiting for it for ages :). But I can't get it to work. I am setting the licenseUrl and certificate ArrayBuffer as described in your comment above. Then trying to load the corresponding m3u8 manifest. But I get a couple of different errors.
I assumed that it might be an issue with getting the license key since we need to append a session key and ticket number to the request. I tried registering a request filter for this, but it seems its not even getting as far as the license, since the filter doesn't seem to be firing at all (fires fine on chrome using widevine). This is the line for the key info in the manifest.
I have also attached an image with the logs in my safari browser from shaka Not sure what is happening here. I am working on getting permissions to share the manifest with you but until then, any pointers? (At the moment we are using a raw implementation using safari's webkit apis. This implementation works fine. Let me know if steps describing this implementation are of any use) |
In issue #279 it was mentioned that "The status of Fairplay through EME is unknown at this time." Can you elaborate on what you mean by this? We have some apple sample code that shows Fairplay playback in Safari. However trying to play the same content through Shaka with an HLS Parser plugin is not going so smoothly. I'm not sure the MediaKeys polyfill is working correctly on Safari. Have you tested in Safari?
I can get more detailed logs and specific failings in the next few days but I wanted to initially enquire about the compatibility of the MediaKeys polyfill and the Safari (9.1) EME implementation.
The text was updated successfully, but these errors were encountered: