Retry the video in case of Network error
avinlakhera opened this issue · 4 comments
Hi,
How can i retry for the video when I gets network error. I have tried to get error using
this.player.on('error',(e)={
console.log(e)
})
But this one doesn't catch any error even though I am getting 404 error in console.
Any suggestion for this one
Thanks,
@avinlakhera I had a similar issue. After looking at the code, it seems that all hls.js events are broadcasted to the tech component (https://github.com/Peer5/videojs-contrib-hls.js/blob/master/src/videojs5.hlsjs.js#L96):
player.tech_.on('manifestLoadError', function () {
// do something...
});
Full list with error events thrown by hls.js - hls.js errors (hls.js API)
@ganigeorgiev I'm unable to trigger any of the error handlers on tech_
. What was the scenario that fired the error for you?
@hoodsy Oops, probably I didn't check the exact event error in my previous comment or something has changed from the last time I used it.
Looking back at the code (Line #100) only Hls Runtime Events are broadcasted. To handle the error you could listen to Hls.Events.ERROR
and check its type (or other error data specific property).
jsfiddle example - https://jsfiddle.net/m3sf8nav/