Skip to content
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

Merged
merged 5 commits into from
Dec 1, 2020

Conversation

gesinger
Copy link
Contributor

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

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
  • Reviewed by Two Core Contributors

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.
Copy link
Contributor

@brandonocasey brandonocasey left a 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() {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

keySystems: keySystemsOptions
});
keySessionCreatedPromises.push(new Promise((resolve, reject) => {
player.tech_.one('keysessioncreated', () => {
Copy link
Contributor

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 () => {}

Copy link
Contributor

@brandonocasey brandonocasey left a 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.

@gkatsev gkatsev added this to the 2.4 milestone Dec 1, 2020
Copy link
Member

@gkatsev gkatsev left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants