videojs / videojs-contrib-eme

Supports Encrypted Media Extensions for playback of encrypted content in Video.js
Other
203 stars 72 forks source link

Safari fires handleEncryptedEvent with error #79

Closed linasvalikonis closed 5 years ago

linasvalikonis commented 5 years ago

Hi,

I've tried to play HLS encoded video with FairPlay DRM, but it is failing on some safari versions.

Playing: macOS High Sierra 10.13.6 with Safari 12.1 (13607.1.40.1.5). - handleEncryptedEvent not fired Not playing: macOS Mojave 10.14.4 with Safari 12.1 (14607.1.40.1.4). - handleEncryptedEvent fired

What I have found, player throws error in handleEncryptedEvent function, which is fired with 'encrypted' event.

Fast solution:

if (navigator.userAgent.match(/Safari/i) && !navigator.userAgent.match(/Chrome/i)) { // SKIP } else { player.tech.el.addEventListener('encrypted', function (event) { // TODO convert to videojs.log.debug and add back in // https://github.com/videojs/video.js/pull/4780 // videojs.log('eme', 'Received an \'encrypted\' event'); setupSessions(player); console.log('encrypted'); handleEncryptedEvent(event, getOptions(player), player.eme.sessions, player.tech_).catch(emeError); }); // Support Safari EME with FairPlay // (also used in early Chrome or Chrome with EME disabled flag) }

videojs-contrib-eme @version 3.5.0

Need to fix this

ILanor commented 5 years ago

Hello! Is there any updates about this issue?