-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add support for Certurl element #4876
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
base: development
Are you sure you want to change the base?
Conversation
… Moreover, added CertUrlUtils for normalizing and deduping cert urls.
# Conflicts: # src/streaming/protection/controllers/ProtectionController.js
dsilhavy
left a comment
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.
Thanks @gorkemg . Some code format comments, I havent checked the functionality yet. I will let you know if I have additional comments after testing
| * @property {boolean} [ignoreKeyStatuses=false] | ||
| * If set to true the player will ignore the status of a key and try to play the corresponding track regardless whether the key is usable or not. | ||
| * | ||
| * @property {number} [certificateRetryAttempts=2] |
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 these fields to the index.d.ts
| LA_URL: 'Laurl', | ||
| LA_URL_LOWER_CASE: 'laurl', | ||
| CERT_URL: 'Certurl', | ||
| CERT_URL_LOWER_CASE: 'certurl', |
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.
Do we need this or can we just convert CERT_URL programmatically to lower case?
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 can drop CERT_URL_LOWER_CASE and compare the manifest element name case-insensitively (e.g. name.toLowerCase() === 'certurl'. I added both to mirror existing LA_URL handling for consistency, but it is not technically required.
| @@ -0,0 +1,65 @@ | |||
| /** | |||
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 the default header here:
/**
* The copyright in this software is being made available under the BSD License,
* included below. This software may be subject to other third party and contributor
* rights, including patent rights, and no such rights are granted under this license.
*
* Copyright (c) 2013, Dash Industry Forum.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
* * Neither the name of Dash Industry Forum nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
src/dash/vo/ContentProtection.js
Outdated
| this.pssh = data.hasOwnProperty(DashConstants.PSSH) ? data[DashConstants.PSSH] : null; | ||
| this.pro = data.hasOwnProperty(DashConstants.PRO) ? data[DashConstants.PRO] : null; | ||
| this.laUrl = data.hasOwnProperty(DashConstants.LA_URL) ? data[DashConstants.LA_URL] : data.hasOwnProperty(DashConstants.LA_URL_LOWER_CASE) ? data[DashConstants.LA_URL_LOWER_CASE] : null; | ||
| const rawCert = data[DashConstants.CERT_URL] || data[DashConstants.CERT_URL_LOWER_CASE]; |
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 use hasOwnProperty syntax here to keep the code consistent
| * @private | ||
| */ | ||
| function _acquireCertificateFromManifest() { | ||
| if (!selectedKeySystem) { return; } |
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.
Minor reformating:
if (!selectedKeySystem) {
return;
}
const ksString = selectedKeySystem.systemString;
const cacheEntry = certificateCache.get(ksString);
if (cacheEntry && (cacheEntry.applied || cacheEntry.inProgress)) {
return;
}
// Gather certUrls from collected mediaInfoArr contentProtection entries matching this key system
const preferredType = settings.get().streaming.protection.preferredCertType;
const certCandidates = _collectCertificateUrlsForSelectedKeySystem(preferredType);
if (!certCandidates.length) {
return;
}
src/streaming/MediaPlayer.js
Outdated
| * ]); | ||
| */ | ||
| function addCertUrls(keySystemString, certUrls) { | ||
| if (!keySystemString || !certUrls) { return; } |
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.
Minor reformating:
if (!keySystemString || !certUrls) {
return;
}
const normalized = CertUrlUtils.normalizeCertUrls(certUrls);
if (!normalized.length) {
return;
}…dash.js into feature/certurl
… ContentProtection for consistency
This PR adds support for CertUrl element in Manifest, but also adds API to add CertUrl programmatically (Issue #4803).