|
|
|
@ -103,6 +103,7 @@ async function attachPlayer(url) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
const { default: Hls } = await import('hls.js') |
|
|
|
if (seq !== attachSeq) return |
|
|
|
if (!Hls.isSupported()) { |
|
|
|
@ -121,13 +122,20 @@ async function attachPlayer(url) { |
|
|
|
if (seq !== attachSeq) return |
|
|
|
video.play().catch(() => {}) |
|
|
|
}) |
|
|
|
} catch (_) { |
|
|
|
if (seq === attachSeq) emit('error') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
watch( |
|
|
|
() => props.playUrl, |
|
|
|
(url) => { |
|
|
|
if (playable.value) attachPlayer(url) |
|
|
|
else destroyPlayer() |
|
|
|
if (playable.value) { |
|
|
|
attachPlayer(url).catch(() => {}) |
|
|
|
} else { |
|
|
|
attachSeq += 1 |
|
|
|
destroyPlayer() |
|
|
|
} |
|
|
|
}, |
|
|
|
{ immediate: true } |
|
|
|
) |
|
|
|
|