diff --git a/src/player.js b/src/player.js index 1183191..9ffd071 100644 --- a/src/player.js +++ b/src/player.js @@ -137,11 +137,6 @@ function liveStatus (status) { viewers.style.display = 'none' handleWebSocket(false) - - retryTimeout = setTimeout(() => { - if (vidReady) return - loadSource() - }, 10000) } } @@ -295,10 +290,16 @@ if (Hls.isSupported()) { loadSource() hls.on(Hls.Events.MANIFEST_PARSED, () => { vidReady = true + clearTimeout(retryTimeout) }) hls.on(Hls.Events.ERROR, (e) => { vidReady = false + retryTimeout = setTimeout(() => { + if (vidReady) return + loadSource() + }, 10000) + if (!vid.paused) { toggleStream() resetHide()