I want to use video.js to display a DRM-protected livestream that will work in the major browsers. I have a Fairplay livestream (for Apple devices) and a Widevine/Playready livestream (for everything else). I've confirmed that my livestreams work as standalone players on the appropriate platforms, what I'm not sure about is what approach to take to dynamically serve the Fairplay livestream/licenses to Apple devices and the MPEG-DASH stream/licences to everyone else.
detectSupportedCDMs() doc in https://github.com/videojs/videojs-contrib-eme/ says 'be carefule about using this' and I've seen notes that it fails?
This all seems like the usecase for DRM with video.js but I can't find any sample code. Has anyone else set this up?
The answer to this is surprisingly un-documented.
A first big thing I didn't understand was that Fairplay is only for Safari, even on MacOS and iOS. Firefox and Chrome on MacOS use Widevine, Firefox on iOS uses Widevine, and Chrome and MS Edge on iOS use Fairplay.
Another thing is that player.eme.detectSupportedCDMs() both doesn't currently return anything but an error AND is completely unnecessary.
Assuming that 'dashsrc' is the src for our MPEG-DASH with Widevine/Playready DRM, and 'fairplaysrc' is the src for our HLS with Fairplay DRM, we can use the video.js Browser object contents to decide which to use:
The solution above took much to much time to figure out.
Here's the complete code that worked using an EZDRM livestream setup to have a combined Widevine/Playready MPEG-DASH and an HLS Fairplay: