video-dev / hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
https://hlsjs.video-dev.org/demo
Other
15.01k stars 2.59k forks source link

Detect first 404 on manifest/ts #231

Closed ariselseng closed 8 years ago

ariselseng commented 8 years ago

Hi, Is there an event that fires when there is a network error? I am using the stalled event, but it fires when the buffer is empty. I need to know the second the server is down so that I can change the host.

Also, how can I change host without the video to stop going down? Lets say I have two edge nodes: a.stream.com/hls/stream.m3u8 b.stream.com/hls/stream.m3u8

How can I change from a to b if a fails? Ideally, it would be detected long before stalled event, so that user wouldn't notice.

mangui commented 8 years ago

as explained in README, hls.js supports failover/redundant streams, refer to https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/UsingHTTPLiveStreaming/UsingHTTPLiveStreaming.html#//apple_ref/doc/uid/TP40008332-CH102-SW22

fo network and other error, also RTFM : https://github.com/dailymotion/hls.js/blob/master/API.md#fifth-step--error-handling

ariselseng commented 8 years ago

About the redundant streams. That may be my best option actually, as that would make it redundant for native HLS playback as well.

Anyways. I tried yesterday with:

hls.on("hlsError", function(event, data) {
   alert("ERROR")
})

But the alert does not come until the video stops. I was hoping there was other events I was not getting. I guess its just about lowering default timeouts.