fix(HLS): Fix switching between muxed and alternate audios (#8741)

Fixes https://github.com/shaka-project/shaka-player/issues/8737
This commit is contained in:
Álvaro Velad Galván
2025-06-12 13:48:43 +02:00
committed by GitHub
parent 4ac3c97c8c
commit c1e2f7aab5
2 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -2670,7 +2670,8 @@ shaka.hls.HlsParser = class {
if (type == ContentType.VIDEO || type == ContentType.AUDIO) {
for (const otherStreamInfo of this.uriToStreamInfosMap_.values()) {
if (!otherStreamInfo.loadedOnce && otherStreamInfo.type == type) {
if (!otherStreamInfo.loadedOnce && otherStreamInfo.type == type &&
!otherStreamInfo.stream.isAudioMuxedInVideo) {
// To aid manifest filtering, assume before loading that all video
// renditions have the same MIME type. (And likewise for audio.)
otherStreamInfo.stream.mimeType = realStream.mimeType;
+3 -2
View File
@@ -2980,6 +2980,7 @@ shaka.media.StreamingEngine = class {
if (audioMediaState.segmentIterator) {
audioMediaState.segmentIterator.resetToLastIndependent();
}
this.cancelUpdate_(audioMediaState);
}
const videoMediaState = this.mediaStates_.get(ContentType.VIDEO);
if (videoMediaState) {
@@ -2993,14 +2994,14 @@ shaka.media.StreamingEngine = class {
if (videoMediaState.segmentIterator) {
videoMediaState.segmentIterator.resetToLastIndependent();
}
this.cancelUpdate_(videoMediaState);
}
/**
* @type {!Map<shaka.util.ManifestParserUtils.ContentType,
* shaka.extern.Stream>}
*/
const streamsByType = new Map();
if (this.currentVariant_.audio &&
!this.currentVariant_.audio.isAudioMuxedInVideo) {
if (this.currentVariant_.audio) {
streamsByType.set(ContentType.AUDIO, this.currentVariant_.audio);
}
if (this.currentVariant_.video) {