Skip to content

Conversation

@gorkemg
Copy link
Contributor

@gorkemg gorkemg commented Oct 28, 2025

This PR adds support for CertUrl element in Manifest, but also adds API to add CertUrl programmatically (Issue #4803).

@gorkemg gorkemg linked an issue Oct 28, 2025 that may be closed by this pull request
@dsilhavy dsilhavy added this to the 5.1.1 milestone Oct 28, 2025
@dsilhavy dsilhavy self-requested a review October 28, 2025 14:44
# Conflicts:
#	src/streaming/protection/controllers/ProtectionController.js
Copy link
Collaborator

@dsilhavy dsilhavy left a 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]
Copy link
Collaborator

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',
Copy link
Collaborator

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?

Copy link
Contributor Author

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 @@
/**
Copy link
Collaborator

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.
 */

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];
Copy link
Collaborator

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; }
Copy link
Collaborator

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;
        }

* ]);
*/
function addCertUrls(keySystemString, certUrls) {
if (!keySystemString || !certUrls) { return; }
Copy link
Collaborator

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;
        }

@dsilhavy dsilhavy moved this to Selected for Development in dash.js Version 5.1.1 Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Selected for Development

Development

Successfully merging this pull request may close these issues.

Add support for Certurl element

4 participants