mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-28 08:06:06 +00:00
Fix switching from hls source to hls source
This commit is contained in:
parent
af2e6b793d
commit
855e594c09
|
@ -83,7 +83,8 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
|
||||||
|
|
||||||
function reportAudioTracks() {
|
function reportAudioTracks() {
|
||||||
if (!hls) return;
|
if (!hls) return;
|
||||||
const currentTrack = hls.audioTracks[hls.audioTrack];
|
const currentTrack = hls.audioTracks?.[hls.audioTrack ?? 0];
|
||||||
|
if (!currentTrack) return;
|
||||||
emit("changedaudiotrack", {
|
emit("changedaudiotrack", {
|
||||||
id: currentTrack.id.toString(),
|
id: currentTrack.id.toString(),
|
||||||
label: currentTrack.name,
|
label: currentTrack.name,
|
||||||
|
@ -129,6 +130,7 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupSource(vid: HTMLVideoElement, src: LoadableSource) {
|
function setupSource(vid: HTMLVideoElement, src: LoadableSource) {
|
||||||
|
hls = null;
|
||||||
if (src.type === "hls") {
|
if (src.type === "hls") {
|
||||||
if (canPlayHlsNatively(vid)) {
|
if (canPlayHlsNatively(vid)) {
|
||||||
vid.src = processCdnLink(src.url);
|
vid.src = processCdnLink(src.url);
|
||||||
|
|
Loading…
Reference in a new issue