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
1 changed files with 6 additions and 5 deletions

View File

@ -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()