Commit 54b02600 authored by Jakub Adam's avatar Jakub Adam
Browse files

Recover HLS player after network failure

parent 4141b310
...@@ -31,8 +31,19 @@ ...@@ -31,8 +31,19 @@
var hls = new Hls({ var hls = new Hls({
liveDurationInfinity: true liveDurationInfinity: true
}); });
hls.loadSource('hls/playlist.m3u8');
hls.on(Hls.Events.ERROR, (e, data) => {
if (data.type == "networkError") {
setTimeout(() => {
hls.recoverMediaError()
hls.loadSource('hls/playlist.m3u8')
}, 1000)
}
console.log(data)
})
hls.attachMedia(hls_video); hls.attachMedia(hls_video);
hls.loadSource('hls/playlist.m3u8');
} }
var client = new mss.Client() var client = new mss.Client()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment