videojs / videojs-contrib-eme

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

fix: use in-spec EME for versions of Safari which support it #87

Closed squarebracket closed 3 years ago

squarebracket commented 5 years ago

haven't updated the docs yet.

squarebracket commented 5 years ago

Note that, as I said in #86, you must add {initDataTypes: ['sinf'], videoCapabilities: [{contentType: 'video/mp4'}]} to your keySystems.

squarebracket commented 5 years ago

Ok, I think this one is ready. Added some tests and stuff.

Manually tested on:

squarebracket commented 5 years ago

Closes #79.

squarebracket commented 5 years ago

I found a problem when testing #80 (which, incidentally, does not seem to this problem). Right here, I'm actually overwriting the object when I should simply assign to the object.

squarebracket commented 5 years ago

One other thing. When using newer Safari with the default fairplay getLicense, you get a warning that using an ArrayBuffer with XMLHttpRequest.send() is deprecated. If right here https://github.com/videojs/videojs-contrib-eme/blob/c574b43c8b26f5ce904a766f8045e2421459abca/src/fairplay.js#L140

We instead do

body: new Uint8Array(keyMessage),

This warning does not appear. Is that something you think we could do?

Alternatively, we could use the defaultGetLicense for eme instead of the default one for fairplay, but that gets a bit complicated because here you'd have to know whether or not you're using the default getLicense.

misteroneill commented 5 years ago

I think we'd be safe casting it to Uint8Array. I think there's an expectation that the default* methods may change to better suit the changing reality of browsers.

alenzalex commented 4 years ago

https://github.com/videojs/videojs-contrib-eme/issues/105

alenzalex commented 4 years ago

Safari Version : 13.1

When I play DRM content in safari, I get error as KeySession error: code 6, systemCode 4294924646 with error code as : (CODE:5 MEDIA_ERR_ENCRYPTED)

Then, it displays error as The media playback was aborted due to a corruption problem or because the media used features your browser did not support with error code : (CODE:3 MEDIA_ERR_DECODE)

AwokeKnowing commented 4 years ago

@squarebracket can you clarify what you mean by you must add {initDataTypes: ['sinf'], videoCapabilities: [{contentType: 'video/mp4'}]} to your keySystems.

https://github.com/videojs/videojs-contrib-eme/issues/118

my initData looks like this when decoded to string, and then the concat data id and cert method throws because of 'not aligned' which I assume is because init data is wrapped?

"{
  \"sinf\" : [
    \"AAAADGZybWFtcDRhAAAAFHNjaG0AAAAAY2JjcwABAAAAAAA5c2NoaQAAADF0ZW5jAQAAAAAAAQBVfi4NGlUpptLaOvCQxUuIEK6Awu7gJUgka4p2J91djjU=\"
  ]
}"
squarebracket commented 4 years ago

@AwokeKnowing These are unrelated. This PR added a hotfix to use the old prefixed EME version because we couldn't get the in-spec EME working. That was because of the missing {initDataTypes: ['sinf'], videoCapabilities: [{contentType: 'video/mp4'}]} that I outlined above, which should probably (for this PR) be added to the default object that's created when using safari with in-spec EME, so that problems don't happen.

squarebracket commented 4 years ago

Nevermind, it looks like I did add it to the default object in this PR. It's been a while since I wrote this :sweat_smile:

gkatsev commented 3 years ago

Thanks for getting this started @squarebracket! It finally made it in via #142, sorry it's taken so long!