Skip to content

Commit

Permalink
Fix regression in key system selection based on priority (#3935)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbert authored Apr 29, 2022
1 parent b74dc46 commit decaad5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/streaming/protection/controllers/ProtectionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,6 @@ function ProtectionController(config) {
// and video will be the same. Just use one valid MediaInfo object
let supportedKS = protectionKeyController.getSupportedKeySystemsFromContentProtection(mediaInfo.contentProtection, protDataSet, sessionType);

// Reorder key systems according to priority order provided in protectionData
supportedKS = supportedKS.sort((ksA, ksB) => {
let indexA = (protDataSet && protDataSet[ksA.ks.systemString] && protDataSet[ksA.ks.systemString].priority >= 0) ? protDataSet[ksA.ks.systemString].priority : supportedKS.length;
let indexB = (protDataSet && protDataSet[ksB.ks.systemString] && protDataSet[ksB.ks.systemString].priority >= 0) ? protDataSet[ksB.ks.systemString].priority : supportedKS.length;
return indexA - indexB;
});

if (supportedKS && supportedKS.length > 0) {
_selectKeySystem(supportedKS, true);
}
Expand Down Expand Up @@ -174,6 +167,13 @@ function ProtectionController(config) {
keySystemSelectionInProgress = true;
const requestedKeySystems = [];

// Reorder key systems according to priority order provided in protectionData
supportedKS = supportedKS.sort((ksA, ksB) => {
let indexA = (protDataSet && protDataSet[ksA.ks.systemString] && protDataSet[ksA.ks.systemString].priority >= 0) ? protDataSet[ksA.ks.systemString].priority : supportedKS.length;
let indexB = (protDataSet && protDataSet[ksB.ks.systemString] && protDataSet[ksB.ks.systemString].priority >= 0) ? protDataSet[ksB.ks.systemString].priority : supportedKS.length;
return indexA - indexB;
});

pendingKeySystemData.push(supportedKS);

// Add all key systems to our request list since we have yet to select a key system
Expand Down

0 comments on commit decaad5

Please sign in to comment.