diff --git a/src/components/LivePlayer.vue b/src/components/LivePlayer.vue
index 7e34fcf..54b020e 100644
--- a/src/components/LivePlayer.vue
+++ b/src/components/LivePlayer.vue
@@ -9,6 +9,7 @@
ref="videoEl"
controls
autoplay
+ muted
playsinline
/>
@@ -92,14 +93,29 @@ async function attachPlayer(url) {
const video = videoEl.value
if (!video || seq !== attachSeq) return
+ video.muted = true
+ video.defaultMuted = true
+ video.setAttribute('muted', '')
+
video.addEventListener('error', () => {
if (seq !== attachSeq) return
emit('error')
}, { once: true })
+ async function tryPlay() {
+ if (seq !== attachSeq) return
+ try {
+ await video.play()
+ } catch (error) {
+ console.warn('[live-player] autoplay blocked', error)
+ // NotAllowedError: autoplay policy. Do not storm play-url rebuilds.
+ if (error?.name !== 'NotAllowedError' && seq === attachSeq) emit('error')
+ }
+ }
+
if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = url
- try { await video.play() } catch (_) {}
+ await tryPlay()
return
}
@@ -120,7 +136,8 @@ async function attachPlayer(url) {
hls.attachMedia(video)
hls.on(Hls.Events.MANIFEST_PARSED, () => {
if (seq !== attachSeq) return
- video.play().catch(() => {})
+ video.muted = true
+ tryPlay()
})
} catch (_) {
if (seq === attachSeq) emit('error')