-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add license url parsing #1644
Add license url parsing #1644
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
… Tests need to be fixed still.
…de getWideviceLicenseUrl() and getPlayReadyLicenseServerUrl() public so they could be tested
CLAs look good, thanks! |
Any chance I can get some feedback on this? I'm hoping this can make it in 2.5. |
@tylerdaines Definitely! Thanks for the ping and apologies for the delay. @TheModMaker @vaage Guys, could I ask you to take a look since you both worked on the #1010 |
@vaage I think I have addressed all your concerns and reverted my ill-advised white space changes. Anything else I need to look at? |
…de review. Simplified LA_URL xml parsing
…eadyRecord value to be Uint16Array
@vaage Anything else you want me to take a second pass at? |
keyId: null, | ||
schemeUri: '', | ||
node: strToXml([ | ||
'<test xmlns:ms="urn:microsoft">', |
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 don't think this isn't the correct namespace URI.
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.
Couldn't find much on this but I did find this Azure Media sample page that links to this manifest which uses the same namespaces so I think it's correct:
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static"
xmlns:cenc="urn:mpeg:cenc:2013"
xmlns:mspr="urn:microsoft:playready"
xmlns:ms="urn:microsoft" mediaPresentationDuration="PT52.208S" minBufferTime="PT3S">
<Period>
<AdaptationSet ...snip...>
<ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="096D74B9-362D-4110-949B-EC0F5694F750"/>
<ContentProtection schemeIdUri="urn:uuid:9A04F079-9840-4286-AB92-E65BE0885F95" value="2.0" cenc:default_KID="096D74B9-362D-4110-949B-EC0F5694F750">
<mspr:pro>...snip...</mspr:pro>
</ContentProtection>
<ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" cenc:default_KID="096D74B9-362D-4110-949B-EC0F5694F750">
<cenc:pssh>AAAAMnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABISEAltdLk2LUEQlJvsD1aU91A=</cenc:pssh>
<ms:laurl licenseUrl="https://ampvideos.keydelivery.mediaservices.windows.net/Widevine/?kid=096d74b9-362d-4110-949b-ec0f5694f750"/>
</ContentProtection>
...snip...
…seMsPro_ and parseMsProRecords_() to operate on ArrayBuffers
I believe I have addressed all the latest issues. Anything else that needs addressing? |
lib/dash/content_protection.js
Outdated
|
||
records.push({ | ||
type: type, | ||
value: new Uint8Array(recordValue), |
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.
Couldn't you just do new Uint8Array(recordData, byteOffset, byteLength)
?
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.
This is something I went back and forth on and couldn't find a better way. The issue is in the ArrayBuffer recordData
, the data is all 16-bit numbers (i.e. every other byte is 0), so I went with the "cast the Uint16 numbers to Uint8 numbers" approach.
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.
In that case, you should convert to a string here since the data will be UTF-16, not UTF-8 like the later string conversion expects. Skipping every other byte like this only works for ASCII.
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.
You're right. I was too focused on using the existing parseXml
which was expecting UTF-8. Fixed.
lib/dash/content_protection.js
Outdated
} | ||
|
||
const rootElement = shaka.util.XmlUtils.parseXml( | ||
record.value.buffer, 'WRMHEADER'); |
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.
This won't work since it will parse from the beginning of the buffer, not the beginning of the record. You should edit the parseXml
to accept a BufferSource
instead and just pass record.value
.
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.
No longer using parseXml
so I didn't edit it's signature.
Think I fixed all the issues in the latest code review. Anything else? |
All tests passed! |
I can't find my pending comments and this has been in review long enough. If we find issues with it later, we can fix it ourselves.
The build bot says its good. @TheModMaker it looks like you had the most substantial concerns. If you are good with this, I think it is safe to accept it and then we can address any minor issues ourselves. |
Thanks guys! |
FYI, I will create a follow-up to change how this works with the Player configuration. I will change it to use the manifest value as a default and use the Player configuration as an override. This means the manifest value will only be used if you don't specify a license server in the configuration. This is consistent with our other configuration settings being overrides. |
@tylerdaines thanks for your work on this, this will help my team too. :) |
@TheModMaker I'd be happy to take that on if you haven't already started on it. |
Thanks for the offer, but I just pushed that change. |
If the application developer specifies license servers, only those should be used. Before this, a manifest-specified license server for a certain key system could still be used if the application didn't provide one. Now, if there are _any_ license servers specified by the app, _no_ license servers will be used from the manifest. This is important because it allows the application a clear way to indicate which DRM systems should be used on platforms with multiple DRM systems. The new order of preference for drmInfo: 1. Clear Key config, used for debugging, should override everything else. (The application can still specify a clearkey license server.) 2. Application-configured servers, if any are present, should override anything from the manifest. Nuance: if key system A is in the manifest and key system B is in the player config, only B will be used, not A. 3. Manifest-provided license servers are only used if nothing else is specified. Introduced in #1644 to solve #484 Internal issue b/131264101 Closes #1905 Change-Id: I1a36a70044dc7bcc22681e3e4246d0a43d58e413
This PR is based off #1010. It closes #484 and parses license urls from
<ms:laurl>
and<mspr:pro>
in the DASH manifest. I believe I have addressed all the suggestions made in the original PR./cc @forbesjo