Skip to content

Commit

Permalink
Exit gracefully when switching to an audio group with no (supported) …
Browse files Browse the repository at this point in the history
…tracks (#5822)

Resolves #4602
  • Loading branch information
robwalch authored Sep 18, 2023
1 parent 912d099 commit f888cb5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/controller/audio-track-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ class AudioTrackController extends BasePlaylistController {
) {
this.selectDefaultTrack = false;
}

if (!audioTracks.length) {
this.trackId = -1;
this.currentTrack = null;
}
this.tracksInGroup = audioTracks;
const audioTracksUpdated: AudioTracksUpdatedData = { audioTracks };
this.log(
Expand Down Expand Up @@ -213,6 +216,9 @@ class AudioTrackController extends BasePlaylistController {

private selectInitialTrack(): void {
const audioTracks = this.tracksInGroup;
if (!audioTracks.length) {
return;
}
let trackId = this.findTrackId(this.currentTrack);
if (trackId === -1) {
trackId = this.findTrackId(null);
Expand Down

0 comments on commit f888cb5

Please sign in to comment.