@@ -939,18 +939,27 @@ shaka.hls.HlsParser = class {
939
939
mediaPlaylistType = streamInfo . stream . type ;
940
940
941
941
// Wrap the stream from that stream info with a variant.
942
- variants . push ( {
943
- id : 0 ,
944
- language : this . getLanguage_ ( languageValue ) ,
945
- disabledUntilTime : 0 ,
946
- primary : true ,
947
- audio : mediaPlaylistType == 'audio' ? streamInfo . stream : null ,
948
- video : mediaPlaylistType == 'video' ? streamInfo . stream : null ,
949
- bandwidth : streamInfo . stream . bandwidth || 0 ,
950
- allowedByApplication : true ,
951
- allowedByKeySystem : true ,
952
- decodingInfos : [ ] ,
953
- } ) ;
942
+ let variantAllowed = true ;
943
+ if ( this . config_ . disableAudio && streamInfo . type == 'audio' ) {
944
+ variantAllowed = false ;
945
+ } else if ( this . config_ . disableVideo && streamInfo . type == 'video' &&
946
+ ! streamInfo . stream . codecs . includes ( ',' ) ) {
947
+ variantAllowed = false ;
948
+ }
949
+ if ( variantAllowed ) {
950
+ variants . push ( {
951
+ id : 0 ,
952
+ language : this . getLanguage_ ( languageValue ) ,
953
+ disabledUntilTime : 0 ,
954
+ primary : true ,
955
+ audio : streamInfo . type == 'audio' ? streamInfo . stream : null ,
956
+ video : streamInfo . type == 'video' ? streamInfo . stream : null ,
957
+ bandwidth : streamInfo . stream . bandwidth || 0 ,
958
+ allowedByApplication : true ,
959
+ allowedByKeySystem : true ,
960
+ decodingInfos : [ ] ,
961
+ } ) ;
962
+ }
954
963
} else {
955
964
this . parseMasterVariables_ ( variablesTags ) ;
956
965
0 commit comments