Skip to content

Commit 3b8deb8

Browse files
committed
fix(DRM): Fix drm choice when the user provide a server in the manifest
1 parent 0400d1e commit 3b8deb8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/drm/drm_engine.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,17 @@ shaka.drm.DrmEngine = class {
10831083

10841084
// If we have configured preferredKeySystems, choose a preferred keySystem
10851085
// if available.
1086-
for (const preferredKeySystem of this.config_.preferredKeySystems) {
1086+
let preferredKeySystems = this.config_.preferredKeySystems;
1087+
if (!preferredKeySystems.length) {
1088+
// If there is no preference set and we only have one server license, we
1089+
// use this as preference. This is used to override manifests on those
1090+
// that have the embedded license and the browser supports multiple DRMs.
1091+
const servers = shaka.util.MapUtils.asMap(this.config_.servers);
1092+
if (servers.size == 1) {
1093+
preferredKeySystems = servers.keys();
1094+
}
1095+
}
1096+
for (const preferredKeySystem of preferredKeySystems) {
10871097
for (const variant of variants) {
10881098
const decodingInfo = variant.decodingInfos.find((decodingInfo) => {
10891099
return decodingInfo.supported &&

0 commit comments

Comments
 (0)