File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1028,7 +1028,17 @@ shaka.media.DrmEngine = class {
10281028
10291029 // If we have configured preferredKeySystems, choose a preferred keySystem
10301030 // if available.
1031- for ( const preferredKeySystem of this . config_ . preferredKeySystems ) {
1031+ let preferredKeySystems = this . config_ . preferredKeySystems ;
1032+ if ( ! preferredKeySystems . length ) {
1033+ // If there is no preference set and we only have one license server, we
1034+ // use this as preference. This is used to override manifests on those
1035+ // that have the embedded license and the browser supports multiple DRMs.
1036+ const servers = shaka . util . MapUtils . asMap ( this . config_ . servers ) ;
1037+ if ( servers . size == 1 ) {
1038+ preferredKeySystems = Array . from ( servers . keys ( ) ) ;
1039+ }
1040+ }
1041+ for ( const preferredKeySystem of preferredKeySystems ) {
10321042 for ( const variant of variants ) {
10331043 const decodingInfo = variant . decodingInfos . find ( ( decodingInfo ) => {
10341044 return decodingInfo . supported &&
@@ -1053,6 +1063,9 @@ shaka.media.DrmEngine = class {
10531063 continue ;
10541064 }
10551065 const originalKeySystem = decodingInfo . keySystemAccess . keySystem ;
1066+ if ( preferredKeySystems . includes ( originalKeySystem ) ) {
1067+ continue ;
1068+ }
10561069 let drmInfos = drmInfosByKeySystem . get ( originalKeySystem ) ;
10571070 if ( ! drmInfos && this . config_ . keySystemsMapping [ originalKeySystem ] ) {
10581071 drmInfos = drmInfosByKeySystem . get (
You can’t perform that action at this time.
0 commit comments