@@ -283,19 +283,35 @@ function Capabilities() {
283283 return [ genericConfiguration ] ;
284284 }
285285
286- return inputConfig . keySystemsMetadata . map ( ( keySystemMetadata ) => {
287- const curr = { ...genericConfiguration } ;
288- if ( keySystemMetadata . ks ) {
286+ const configurations = [ ] ;
287+
288+ inputConfig . keySystemsMetadata . forEach ( ( keySystemMetadata ) => {
289+
290+ if ( ! keySystemMetadata . ks ) {
291+ configurations . push ( { ...genericConfiguration } ) ;
292+ return ;
293+ }
294+
295+ // If a systemStringPriority is defined by the application we use these values. Otherwise, we use the default system string
296+ // This is useful for DRM systems such as Playready for which multiple system strings are possible for instance com.microsoft.playready and com.microsoft.playready.recommendation
297+ const protDataSystemStringPriority = keySystemMetadata . protData && keySystemMetadata . protData . systemStringPriority ? keySystemMetadata . protData . systemStringPriority : null ;
298+ let systemString = keySystemMetadata . ks . systemString ;
299+
300+ // Use the default values in case no values are provided by the application
301+ const systemStringsToApply = protDataSystemStringPriority ? protDataSystemStringPriority : [ systemString ] ;
302+
303+ systemStringsToApply . forEach ( ( systemString ) => {
304+ const curr = { ...genericConfiguration } ;
289305 curr . keySystemConfiguration = { } ;
290- if ( keySystemMetadata . ks . systemString ) {
291- curr . keySystemConfiguration . keySystem = keySystemMetadata . ks . systemString ;
306+ if ( systemString ) {
307+ curr . keySystemConfiguration . keySystem = systemString ;
292308 }
293309
294310 let robustnessLevel = ''
295311 if ( keySystemMetadata . ks . systemString === ProtectionConstants . WIDEVINE_KEYSTEM_STRING ) {
296312 robustnessLevel = ProtectionConstants . ROBUSTNESS_STRINGS . WIDEVINE . SW_SECURE_CRYPTO ;
297313 }
298- const protData = keySystemMetadata . protData
314+ const protData = keySystemMetadata . protData ;
299315 const audioRobustness = ( protData && protData . audioRobustness && protData . audioRobustness . length > 0 ) ? protData . audioRobustness : robustnessLevel ;
300316 const videoRobustness = ( protData && protData . videoRobustness && protData . videoRobustness . length > 0 ) ? protData . videoRobustness : robustnessLevel ;
301317
@@ -304,9 +320,11 @@ function Capabilities() {
304320 } else if ( type === Constants . VIDEO ) {
305321 curr . keySystemConfiguration [ type ] = { robustness : videoRobustness }
306322 }
307- }
308- return curr
323+ configurations . push ( curr ) ;
324+ } )
309325 } )
326+
327+ return configurations ;
310328 }
311329
312330 function _checkSingleConfigurationWithMediaCapabilities ( configuration ) {
0 commit comments