-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Improve EME Controller: parse PSSH box in manifest #1915
Conversation
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.
Please extend the existing unit tests!
👍
src/controller/eme-controller.js
Outdated
@@ -73,6 +73,18 @@ const getSupportedMediaKeySystemConfigurations = function (keySystem, audioCodec | |||
} | |||
}; | |||
|
|||
function base64ToArrayBuffer (base64String) { |
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.
please make a util module (seperate file) for this :)
src/controller/eme-controller.js
Outdated
} | ||
|
||
// add initData and type if they are not included in playlist | ||
if (this.initData && !this._hasSetMediaKeys) { |
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.
first of all, please document member types in the constructor, and make sure to pre-initialize them with a certain value (null
in this case, and document that it is an ArrayBuffer
type).
please look at how things are already set up when you add things.
for example, private members are prefixed with underscore. that is our coding style-guide, which we are strict about for newly added code.
src/controller/eme-controller.js
Outdated
} | ||
} | ||
|
||
onLevelLoaded (data) { |
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.
please add jsdoc on the data-type you are receiving here
src/controller/eme-controller.js
Outdated
@@ -485,6 +498,35 @@ class EMEController extends EventHandler { | |||
|
|||
this._attemptKeySystemAccess(KeySystems.WIDEVINE, audioCodecs, videoCodecs); | |||
} | |||
|
|||
onFragLoaded (data) { |
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.
please add jsdoc on function params
@@ -252,7 +252,7 @@ export default class M3U8Parser { | |||
decryptiv = keyAttrs.hexadecimalInteger('IV'); | |||
if (decryptmethod) { | |||
levelkey = new LevelKey(); | |||
if ((decrypturi) && (['AES-128', 'SAMPLE-AES', 'SAMPLE-AES-CENC'].indexOf(decryptmethod) >= 0)) { | |||
if ((decrypturi) && (['AES-128', 'SAMPLE-AES', 'SAMPLE-AES-CENC', 'SAMPLE-AES-CTR'].indexOf(decryptmethod) >= 0)) { |
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.
great
@tchakabam: Updated as per comments, please let me know if it knows further updating. Thanks. 👍 |
Continued in #1918. |
This PR will...
Add support for parsing PSSH element from manifest rather than relying on embedded in the init segment.
Why is this Pull Request needed?
Background
According to the
"cenc" Initialization Data
spec, it "...also specifies storage of a 'pssh' box base64-encoded in an XML element of the form <cenc:pssh (base64 'pssh')>." In our case it's in the hls manfiest which according to the Widevine with DRM doc, it should be in the URI like so:URI=”data:text/plain;base64,<base64 encoded PSSH box>”
Current Widevine Sample Stream
In the case of this sample widevine stream: https://storage.googleapis.com/shaka-demo-assets/angel-one-widevine-hls/hls.m3u8, the init.mp4 has the necessary pssh information for the
encrypted
event to be triggered.But that information is also in the manifest:
Are there any points in the code the reviewer needs to double check?
base64ToArrayBuffer
be in it's own file?levelKey
to the level but we may need to think about situations where there are multi-drm streams with more than one key tag. ( I have a separate WIP branch which I'm looking into this )https://github.com/video-dev/hls.js/pull/1915/files#diff-66dbb17319c4f0d5f009baca4e3ecf36R484
Resolves issues:
Checklist