-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wait for EME initialization before appending content #1002
Wait for EME initialization before appending content #1002
Conversation
This is particularly important for Chrome, where, if unencrypted content is appended before encrypted content and the key session has not been created, a MEDIA_ERR_DECODE will be thrown once the encrypted content is reached during playback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code mostly lgtm, I do have an issue though. Will this break ie 11 since it doesn't support promises at all? I think we do some polyfilling for ie 11 in eme, but not here.
this.initializedEme_ = false; | ||
} | ||
|
||
initializedEme() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this isn't a big deal, but should the source updater be the one to worry about initialized eme? to me that seems like a no, but if its the only place we can do it in a shared way, I kinda understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that for a bit, and the reason I put it here was because it technically should worry about it, since Chrome's source buffers care about order of operations, source updater, being the closest to the source buffers, needs to worry as well.
src/videojs-http-streaming.js
Outdated
keySystems: keySystemsOptions | ||
}); | ||
keySessionCreatedPromises.push(new Promise((resolve, reject) => { | ||
player.tech_.one('keysessioncreated', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can just pass resolve, without the wrapper () => {}
Also change Promise.any to Promise.race to better handle behavior and support Safari versions before 14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will have to make sure to test drm content on IE 11 but the code looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this Chrome, Firefox, and Safari on macOS as well as Chrome, IE11, and Chromium Edge on Windows 10.
Works well everywhere. IE11 and Edge has the known issue where transitioning between clear content and DRMed content will not play the DRM content well.
Requires videojs/videojs-contrib-eme#124
Description
Wait for EME initialization before appending content. This is particularly important for Chrome, where, if unencrypted content is appended before encrypted content and the key session has not been created, a MEDIA_ERR_DECODE will be thrown once the encrypted content is reached during playback.
Requirements Checklist