Skip to content

Commit

Permalink
fix(DRM): Fix drm choice when the user provide a server in the manife…
Browse files Browse the repository at this point in the history
…st (#8067)

Fixes #8066
  • Loading branch information
avelad committed Feb 17, 2025
1 parent 0700000 commit 64d1e88
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/drm/drm_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,17 @@ shaka.drm.DrmEngine = class {

// If we have configured preferredKeySystems, choose a preferred keySystem
// if available.
for (const preferredKeySystem of this.config_.preferredKeySystems) {
let preferredKeySystems = this.config_.preferredKeySystems;
if (!preferredKeySystems.length) {
// If there is no preference set and we only have one license server, we
// use this as preference. This is used to override manifests on those
// that have the embedded license and the browser supports multiple DRMs.
const servers = shaka.util.MapUtils.asMap(this.config_.servers);
if (servers.size == 1) {
preferredKeySystems = Array.from(servers.keys());
}
}
for (const preferredKeySystem of preferredKeySystems) {
for (const variant of variants) {
const decodingInfo = variant.decodingInfos.find((decodingInfo) => {
return decodingInfo.supported &&
Expand All @@ -1108,6 +1118,9 @@ shaka.drm.DrmEngine = class {
continue;
}
const originalKeySystem = decodingInfo.keySystemAccess.keySystem;
if (preferredKeySystems.includes(originalKeySystem)) {
continue;
}
let drmInfos = drmInfosByKeySystem.get(originalKeySystem);
if (!drmInfos && this.config_.keySystemsMapping[originalKeySystem]) {
drmInfos = drmInfosByKeySystem.get(
Expand Down

0 comments on commit 64d1e88

Please sign in to comment.