1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-29 16:07:40 +01:00

Fix switching from hls source to hls source

This commit is contained in:
Jorrin 2024-04-05 19:16:46 +02:00
parent af2e6b793d
commit 855e594c09

View file

@ -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);