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

Widevine eme #2194

Closed
wants to merge 1,025 commits into from
Closed

Conversation

realeyes-matthew
Copy link

@realeyes-matthew realeyes-matthew commented Mar 26, 2019

Note: I can't check all the boxes on the checklist at the bottom, so any help or guidance to align this with standards is greatly appreciated

This PR will...

...revise the EME controller to allow the user to control the EME configuration process. It exposes 3 hooks that the user implements if emeEnabled is true. These hooks allow the user to select the desired KeySystem (requestMediaKeySystemAccessFunc), provide the key session with the init data when a request is generated (getEMEInitializationDataFunc) and control the license retrieval flow (getEMELicenseFunc). Events and errors have been added for each step in the EME configuration process, as well as guards in the stream controllers to ensure that DRM-encrypted data is not decrypted by the key loader. API docs have also been updated.

Why is this Pull Request needed?

Currently, the user does not have much control over the EME configuration process, especially around license requests (e.g. appending tokens). The user can now also choose the KeySystem they want to use in the requestMediaKeySystemAccessFunc, which helps us prepare to support Playready. This PR also splits out EME-related events from key events, and guards against DRM-encrypted data being decrypted like traditional AES-encrypted content.

Are there any points in the code the reviewer needs to double check?

I need to write tests, so any help or guidance with doing this correctly would be greatly appreciated.

Resolves issues:

This PR includes documentation per Issue #2016

Checklist

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • API or design changes are documented in API.md

@johnBartos
Copy link
Collaborator

@realeyes-matthew Looks like you need to rebase against master

@realeyes-matthew realeyes-matthew changed the base branch from 1.0.0 to master April 5, 2019 17:51
Copy link
Member

@michaelcunningham19 michaelcunningham19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm always open to possibly expanding functionality, especially where the EMEController is relatively new - it's not surprising there is room for additional config hooks.

That being said, I'm having a hard time figuring out all the changes in this PR.
I'm seeing many changes unrelated to Widevine/EME

@realeyes-matthew Could you update this PR to keep changes to a minimum & focused on the task at hand? It makes reviewing far easier and makes us more confident in what we're approving/merging into master.

Feel free to open issues (following the templates) for the unrelated changes you've made here - assuming they actually fix an issue / or are otherwise beneficial changes.

A couple more things:

  • Could you also squash your commits? 47 commits in one PR is rather large
  • You don't need to commit anything in the dist directory 😄

src/hls.js Show resolved Hide resolved
@realeyes-matthew
Copy link
Author

realeyes-matthew commented Apr 24, 2019

@michaelcunningham19 Thanks for the reply. I've removed the code that is not related to EME, squashed my commits and removed the changes in dist. The PR should actually now be ready for review :)

EDIT: Spoke too soon. Squashing my commits and rebasing onto master brought in all sorts of changes I did not make. Can you point me in the direction of something that would help me understand how to fix this?

EDIT 2: Finally got the code back to where it needs to be for the PR. Once again ready to review

@realeyes-matthew realeyes-matthew force-pushed the widevine-eme branch 4 times, most recently from 8e23aa3 to 703c5c8 Compare April 26, 2019 01:01
@realeyes-matthew
Copy link
Author

realeyes-matthew commented Apr 26, 2019

While I apologize this is unsquashed (a bad merge is causing rebase problems), this PR is ready for review. I updated the changes to listen for the encrypted event, so users can now configure EME normally, and even if the PSSH box has been stripped from the init frag. API docs have been revised and the demo has been updated to reflect the new API.

@johnBartos johnBartos added this to the 1.0.0 milestone May 8, 2019
@realeyes-matthew realeyes-matthew changed the base branch from master to 1.0.0 May 14, 2019 19:03
@realeyes-matthew realeyes-matthew changed the base branch from 1.0.0 to master May 14, 2019 19:04
@realeyes-matthew
Copy link
Author

@johnBartos @itsjamie I finished writing the tests for the new EME controller. However, when I tried changing the base to 1.0.0, we have all sorts of changes unrelated to EME. Do you have any advice on how I should proceed since we want this to go into 1.0.0?

@johnBartos
Copy link
Collaborator

@realeyes-matthew Try again, I rebased 1.0.0 against master

@realeyes-matthew realeyes-matthew changed the base branch from master to 1.0.0 May 14, 2019 19:16
@realeyes-matthew
Copy link
Author

@johnBartos Worked like a charm, now just needs review

JuliusThms and others added 9 commits June 5, 2019 13:33
* Compute live start position for alt audio streams
* Move codecs to typescript file.

* Type codecs helpers.

* Rename cues to be TypeScript.

* Rename cea-608 parser to TS.

* Type CEA-608 parser and Cue utility.

* Rename output filter to ts.

* Add OutputFilter class.

* Rename ewma bandwidth estimator to TS.

* Rename ewma to TS.

* Type EWMA utilties.

* Add MediaKeys TS and type HlsConfig in EME controller.

* Rename TextTrack utilities.

* Add types to TextTrack utils.

* Rename time-ranges to TS.

* Add Types to TimeRange helpers.

* Remove unused variables from cea-608 parser..

* Type defaultEstimate as a number for ewma estimator.
…xer flush (video-dev#215)

* Refactor minProbeByteLength to only be enforced on transmuxer flush JW8-8993
onMediaDetaching() {
if (this.emeEnabled) {
const keySessionClosePromises: Promise<void>[] = this._keySessions.map((keySession) => {
return keySession.close();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

should we execute this._media.setMediaKeys(null) as well?

# Conflicts:
#	karma.conf.js
#	src/config.ts
#	src/controller/audio-stream-controller.js
#	src/controller/eme-controller.ts
#	src/controller/stream-controller.js
#	src/errors.ts
#	src/events.js
#	tests/unit/controller/eme-controller.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.