Skip to content

Commit

Permalink
Don't use standard EME on iOS >= 16
Browse files Browse the repository at this point in the history
As described in videojs#181
using standards based EME on iOS >= 16 doesn't currently work with
videojs-contrib-eme. (Downgrading videojs-contrib-eme to 3.x basically
prefers WebKitMediaKeys over MediaKeys)

So guard the usage of MediaKeys by the IOS version and use
WebKitMediaKeys for IOS 16 and above.
  • Loading branch information
cfra committed Feb 18, 2023
1 parent 7e55aba commit 49701d3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,23 @@ const onPlayerReady = (player, emeError) => {
});
}

if (window.MediaKeys) {
if (window.MediaKeys
&& (!videojs.browser.IS_IOS
|| videojs.browser.IOS_VERSION < 16
|| !window.WebKitMediaKeys)) {
// Support EME 05 July 2016
// Chrome 42+, Firefox 47+, Edge, Safari 12.1+ on macOS 10.14+
// Playback on IOS >= 16 fails if using standards based EME, so fall back
// to WebKitMediaKeys for these versions.
// The issue with standards based EME is basically tracked here:
// https://github.com/videojs/videojs-contrib-eme/issues/181
// (Downgrading to 3.x makes videojs-contrib-eme not use standards based EME)
//
// With IOS 15 there was an issue that needed standards based EME,
// this can be found here:
// https://github.com/videojs/videojs-contrib-eme/issues/140
//
// All in all, this seems pretty broken. :(
player.tech_.el_.addEventListener('encrypted', (event) => {
// TODO convert to videojs.log.debug and add back in
// https://github.com/videojs/video.js/pull/4780
Expand Down

0 comments on commit 49701d3

Please sign in to comment.