Skip to content

Commit 5585cf9

Browse files
committed
Fix switching back to main audio after end-of-stream buffered
Fixes #7643 (cherry picked from commit 162d581)
1 parent 837b242 commit 5585cf9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/controller/stream-controller.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ export default class StreamController
867867
) {
868868
const hls = this.hls;
869869
// if any URL found on new audio track, it is an alternate audio track
870-
const fromAltAudio = this.altAudio === AlternateAudio.SWITCHED;
870+
const fromAltAudio = this.altAudio !== AlternateAudio.DISABLED;
871871
const altAudio = useAlternateAudio(data.url, hls);
872872
// if we switch on main audio, ensure that main fragment scheduling is synced with media.buffered
873873
// don't do anything if we switch to alt audio: audio stream controller is handling it.
@@ -895,6 +895,7 @@ export default class StreamController
895895
}
896896
// If switching from alt to main audio, flush all audio and trigger track switched
897897
if (fromAltAudio) {
898+
this.altAudio = AlternateAudio.DISABLED;
898899
this.fragmentTracker.removeAllFragments();
899900
hls.once(Events.BUFFER_FLUSHED, () => {
900901
if (!this.hls as any) {

0 commit comments

Comments
 (0)