Skip to content

Commit

Permalink
Add a settings flag to ignore the keystatusmap
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilhavy committed Nov 21, 2024
1 parent f747060 commit 98c8a50
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@ declare namespace dashjs {
keepProtectionMediaKeys?: boolean,
ignoreEmeEncryptedEvent?: boolean,
detectPlayreadyMessageFormat?: boolean,
ignoreKeyStatuses?: boolean,
},
buffer?: {
enableSeekDecorrelationFix?: boolean,
Expand Down
7 changes: 6 additions & 1 deletion src/core/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import Events from './events/Events.js';
* keepProtectionMediaKeys: false,
* ignoreEmeEncryptedEvent: false,
* detectPlayreadyMessageFormat: true,
* ignoreKeyStatuses: false
* },
* buffer: {
* enableSeekDecorrelationFix: false,
Expand Down Expand Up @@ -673,6 +674,9 @@ import Events from './events/Events.js';
*
* @property {boolean} [detectPlayreadyMessageFormat=true]
* If set to true the player will use the raw unwrapped message from the Playready CDM
*
* @property {boolean} [ignoreKeyStatusest=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.
*/

/**
Expand Down Expand Up @@ -885,7 +889,7 @@ import Events from './events/Events.js';
* If not specified this value defaults to ['segment'].
* @property {number} [version=1]
* The version of the CMCD to use.
*
*
* If not specified this value defaults to 1.
*/

Expand Down Expand Up @@ -1109,6 +1113,7 @@ function Settings() {
keepProtectionMediaKeys: false,
ignoreEmeEncryptedEvent: false,
detectPlayreadyMessageFormat: true,
ignoreKeyStatuses: false
},
buffer: {
enableSeekDecorrelationFix: false,
Expand Down
6 changes: 4 additions & 2 deletions src/streaming/protection/controllers/ProtectionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,9 @@ function ProtectionController(config) {
}

const keyIdInHex = Utils.bufferSourceToHex(keyStatus.keyId).slice(0, 32);
keyStatusMap.set(keyIdInHex, keyStatus.status);
if (keyIdInHex && keyIdInHex !== '') {
keyStatusMap.set(keyIdInHex, keyStatus.status);
}
})
eventBus.trigger(events.KEY_STATUSES_MAP_UPDATED, { keyStatusMap });
} catch (e) {
Expand All @@ -1159,7 +1161,7 @@ function ProtectionController(config) {

function areKeyIdsUsable(normalizedKeyIds) {
try {
if (!normalizedKeyIds || normalizedKeyIds.size === 0 || !keyStatusMap || keyStatusMap.size === 0) {
if (!normalizedKeyIds || normalizedKeyIds.size === 0 || !keyStatusMap || keyStatusMap.size === 0 || settings.get().streaming.protection.ignoreKeyStatuses) {
return true;
}

Expand Down

0 comments on commit 98c8a50

Please sign in to comment.