fix(HLS): Fix disableAudio and disableVideo when loading a media playlist (#8642)

This commit is contained in:
Álvaro Velad Galván
2025-05-22 16:57:50 +02:00
committed by GitHub
parent f86245c9cc
commit ccd31aa9d9
+21 -12
View File
@@ -939,18 +939,27 @@ shaka.hls.HlsParser = class {
mediaPlaylistType = streamInfo.stream.type;
// Wrap the stream from that stream info with a variant.
variants.push({
id: 0,
language: this.getLanguage_(languageValue),
disabledUntilTime: 0,
primary: true,
audio: mediaPlaylistType == 'audio' ? streamInfo.stream : null,
video: mediaPlaylistType == 'video' ? streamInfo.stream : null,
bandwidth: streamInfo.stream.bandwidth || 0,
allowedByApplication: true,
allowedByKeySystem: true,
decodingInfos: [],
});
let variantAllowed = true;
if (this.config_.disableAudio && streamInfo.type == 'audio') {
variantAllowed = false;
} else if (this.config_.disableVideo && streamInfo.type == 'video' &&
!streamInfo.stream.codecs.includes(',')) {
variantAllowed = false;
}
if (variantAllowed) {
variants.push({
id: 0,
language: this.getLanguage_(languageValue),
disabledUntilTime: 0,
primary: true,
audio: streamInfo.type == 'audio' ? streamInfo.stream : null,
video: streamInfo.type == 'video' ? streamInfo.stream : null,
bandwidth: streamInfo.stream.bandwidth || 0,
allowedByApplication: true,
allowedByKeySystem: true,
decodingInfos: [],
});
}
} else {
this.parseMasterVariables_(variablesTags);