retry on HLS error instead of live status offline

This commit is contained in:
Evert Prants 2019-10-23 17:08:02 +03:00
parent fa2d87ef18
commit 5d1db70545
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -137,11 +137,6 @@ function liveStatus (status) {
viewers.style.display = 'none' viewers.style.display = 'none'
handleWebSocket(false) handleWebSocket(false)
retryTimeout = setTimeout(() => {
if (vidReady) return
loadSource()
}, 10000)
} }
} }
@ -295,10 +290,16 @@ if (Hls.isSupported()) {
loadSource() loadSource()
hls.on(Hls.Events.MANIFEST_PARSED, () => { hls.on(Hls.Events.MANIFEST_PARSED, () => {
vidReady = true vidReady = true
clearTimeout(retryTimeout)
}) })
hls.on(Hls.Events.ERROR, (e) => { hls.on(Hls.Events.ERROR, (e) => {
vidReady = false vidReady = false
retryTimeout = setTimeout(() => {
if (vidReady) return
loadSource()
}, 10000)
if (!vid.paused) { if (!vid.paused) {
toggleStream() toggleStream()
resetHide() resetHide()