diff --git a/web/player.html b/web/player.html index 836da2d..5a69706 100644 --- a/web/player.html +++ b/web/player.html @@ -205,7 +205,6 @@ video.addEventListener('pause', () => { window.parent.postMessage({ type: 'playback_status', status: 'paused' }, '*'); - if (loading.style.display === 'none') playOverlay.style.display = 'flex'; }); video.addEventListener('playing', () => { @@ -242,7 +241,10 @@ if (video.canPlayType('application/vnd.apple.mpegurl')) { video.src = url; video.load(); - video.play().catch(() => playOverlay.style.display = 'flex'); + video.play().catch(() => { + loading.style.display = 'none'; + playOverlay.style.display = 'flex'; + }); return true; } return false; diff --git a/web/player_lite.html b/web/player_lite.html index dd9c2c5..f91a2f7 100644 --- a/web/player_lite.html +++ b/web/player_lite.html @@ -198,7 +198,8 @@ video.addEventListener('pause', () => { window.parent.postMessage({ type: 'playback_status', status: 'paused' }, '*'); - if (loading.style.display === 'none') { + if (video.currentTime === 0 || video.paused) { + loading.style.display = 'none'; playOverlay.style.display = 'flex'; } }); @@ -232,7 +233,10 @@ if (video.canPlayType('application/vnd.apple.mpegurl')) { video.src = url; video.load(); - video.play().catch(() => playOverlay.style.display = 'flex'); + video.play().catch(() => { + loading.style.display = 'none'; + playOverlay.style.display = 'flex'; + }); return true; } return false; diff --git a/web/player_mobile.html b/web/player_mobile.html index 51f7abd..b5419ef 100644 --- a/web/player_mobile.html +++ b/web/player_mobile.html @@ -188,16 +188,13 @@ }); video.addEventListener('pause', () => { - // Only show play overlay if not loading - if (loading.style.display === 'none') { + // If we're paused and not playing, and it looks like it was blocked or stopped + if (video.currentTime === 0 || video.paused) { + loading.style.display = 'none'; playOverlay.style.display = 'flex'; } }); - video.addEventListener('waiting', () => { - loading.style.display = 'flex'; - playOverlay.style.display = 'none'; - }); video.addEventListener('error', () => { loading.style.display = 'none'; @@ -222,6 +219,7 @@ video.load(); video.play().catch(e => { log('Autoplay blocked by Safari, showing overlay'); + loading.style.display = 'none'; playOverlay.style.display = 'flex'; }); return;