Hi all,
I'm trying to implements all the workflow to play video with DRM on Safari browser.
Following the example by Apple, I've to add a listener on 'webkitneedkey' event and then start all the DRM stuff (loading the certificate... key licence... etc) but that listener doesn't raise up with the usual HLS.js implementation, hls.attachMedia and then hls.loadSource("manifest-url"), but only if I set explicitly the video source like: this.video.src = manifest-url.
The loadSource API is doing the same thing under the hood, isn't it?
Could be a problem setting the source of the video element after using the loadSource HLS.js API?
Thanks in advance
Hey @sbrez
FairPlay HLS on Safari doesn't work through MediaSource API (as Hls.js is implementing playback upon). This proprietary Safari feature (FairPlay DRM) only works through a plain video element src URL property.
There is an implementation of FairPlay support (handling webkit-prefixed events on Safari to initialize media-key setup etc, downloading cert/license) here: https://github.com/chemoish/videojs-fairplay
It is probably the best starting point if you want to play something with FairPlay DRM, or even build some own implementation.
You won't need Hls.js for that, but also can't really use it at all for this purpose :)
I assume here you are talking of Fairplay 1.0, which is explicitely not supported via MediaSource (even though Safari has that API, but only without Fairplay). There apparently exists a spec for FairPlay 2.0 which works via MediaSource API, but this isn't supported in Safari afaik yet.
If you build support for it independent of video.js, please let me know 馃憤 It might always be interesting somehow integrating this with Hls.js. There is one thing that needs additional code in FairPlay HLS, it's when you have external subtitle files (not in the TS chunks), and its not supported by this videojs plugin, but it would be easy to do this with Hls.js since we already support webvtt.
Thanks Stephan, now it's clear. If I'd have some good news, I let you know!!
Most helpful comment
Hey @sbrez
FairPlay HLS on Safari doesn't work through MediaSource API (as Hls.js is implementing playback upon). This proprietary Safari feature (FairPlay DRM) only works through a plain video element
srcURL property.There is an implementation of FairPlay support (handling webkit-prefixed events on Safari to initialize media-key setup etc, downloading cert/license) here: https://github.com/chemoish/videojs-fairplay
It is probably the best starting point if you want to play something with FairPlay DRM, or even build some own implementation.
You won't need Hls.js for that, but also can't really use it at all for this purpose :)
I assume here you are talking of Fairplay 1.0, which is explicitely not supported via MediaSource (even though Safari has that API, but only without Fairplay). There apparently exists a spec for FairPlay 2.0 which works via MediaSource API, but this isn't supported in Safari afaik yet.