@@ -393,11 +393,13 @@ shaka.util.StreamUtils = class {
393
393
* @param {shaka.media.DrmEngine } drmEngine
394
394
* @param {shaka.extern.Manifest } manifest
395
395
* @param {!Array<string>= } preferredKeySystems
396
+ * @param {!Object.<string, string>= } keySystemsMapping
396
397
*/
397
- static async filterManifest ( drmEngine , manifest , preferredKeySystems = [ ] ) {
398
+ static async filterManifest ( drmEngine , manifest , preferredKeySystems = [ ] ,
399
+ keySystemsMapping = { } ) {
398
400
await shaka . util . StreamUtils . filterManifestByMediaCapabilities (
399
401
drmEngine , manifest , manifest . offlineSessionIds . length > 0 ,
400
- preferredKeySystems ) ;
402
+ preferredKeySystems , keySystemsMapping ) ;
401
403
shaka . util . StreamUtils . filterTextStreams_ ( manifest ) ;
402
404
await shaka . util . StreamUtils . filterImageStreams_ ( manifest ) ;
403
405
}
@@ -411,9 +413,11 @@ shaka.util.StreamUtils = class {
411
413
* @param {shaka.extern.Manifest } manifest
412
414
* @param {boolean } usePersistentLicenses
413
415
* @param {!Array<string> } preferredKeySystems
416
+ * @param {!Object.<string, string> } keySystemsMapping
414
417
*/
415
418
static async filterManifestByMediaCapabilities (
416
- drmEngine , manifest , usePersistentLicenses , preferredKeySystems ) {
419
+ drmEngine , manifest , usePersistentLicenses , preferredKeySystems ,
420
+ keySystemsMapping ) {
417
421
goog . asserts . assert ( navigator . mediaCapabilities ,
418
422
'MediaCapabilities should be valid.' ) ;
419
423
@@ -435,7 +439,8 @@ shaka.util.StreamUtils = class {
435
439
const StreamUtils = shaka . util . StreamUtils ;
436
440
437
441
manifest . variants = manifest . variants . filter ( ( variant ) => {
438
- const supported = StreamUtils . checkVariantSupported_ ( variant , keySystem ) ;
442
+ const supported = StreamUtils . checkVariantSupported_ (
443
+ variant , keySystem , keySystemsMapping ) ;
439
444
// Filter out all unsupported variants.
440
445
if ( ! supported ) {
441
446
shaka . log . debug ( 'Dropping variant - not compatible with platform' ,
@@ -485,18 +490,22 @@ shaka.util.StreamUtils = class {
485
490
/**
486
491
* @param {!shaka.extern.Variant } variant
487
492
* @param {?string } keySystem
493
+ * @param {!Object.<string, string> } keySystemsMapping
488
494
* @return {boolean }
489
495
* @private
490
496
*/
491
- static checkVariantSupported_ ( variant , keySystem ) {
497
+ static checkVariantSupported_ ( variant , keySystem , keySystemsMapping ) {
492
498
const variantSupported = variant . decodingInfos . some ( ( decodingInfo ) => {
493
499
if ( ! decodingInfo . supported ) {
494
500
return false ;
495
501
}
496
502
if ( keySystem ) {
497
503
const keySystemAccess = decodingInfo . keySystemAccess ;
498
504
if ( keySystemAccess ) {
499
- if ( keySystemAccess . keySystem != keySystem ) {
505
+ const currentKeySystem =
506
+ keySystemsMapping [ keySystemAccess . keySystem ] ||
507
+ keySystemAccess . keySystem ;
508
+ if ( currentKeySystem != keySystem ) {
500
509
return false ;
501
510
}
502
511
}
0 commit comments