From 855e594c0924bd72212f3d0535754b3b9b7f3f11 Mon Sep 17 00:00:00 2001 From: Jorrin Date: Fri, 5 Apr 2024 19:16:46 +0200 Subject: [PATCH] Fix switching from hls source to hls source --- src/components/player/display/base.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/player/display/base.ts b/src/components/player/display/base.ts index 8322b82b..b1eb616f 100644 --- a/src/components/player/display/base.ts +++ b/src/components/player/display/base.ts @@ -83,7 +83,8 @@ export function makeVideoElementDisplayInterface(): DisplayInterface { function reportAudioTracks() { if (!hls) return; - const currentTrack = hls.audioTracks[hls.audioTrack]; + const currentTrack = hls.audioTracks?.[hls.audioTrack ?? 0]; + if (!currentTrack) return; emit("changedaudiotrack", { id: currentTrack.id.toString(), label: currentTrack.name, @@ -129,6 +130,7 @@ export function makeVideoElementDisplayInterface(): DisplayInterface { } function setupSource(vid: HTMLVideoElement, src: LoadableSource) { + hls = null; if (src.type === "hls") { if (canPlayHlsNatively(vid)) { vid.src = processCdnLink(src.url);