Peer5 / videojs-contrib-hls.js

HLS library for video.js using Dailymotion's hls.js tech
Apache License 2.0
108 stars 55 forks source link

Retry the video in case of Network error #26

Open avinlakhera opened 7 years ago

avinlakhera commented 7 years ago

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,

ganigeorgiev commented 7 years ago

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

hoodsy commented 6 years ago

@ganigeorgiev I'm unable to trigger any of the error handlers on tech_. What was the scenario that fired the error for you?

ganigeorgiev commented 6 years ago

@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/

hoodsy commented 6 years ago

Great, thanks!

On Dec 13, 2017 10:22 AM, "Gani Georgiev" notifications@github.com wrote:

@hoodsy https://github.com/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 https://github.com/Peer5/videojs-contrib-hls.js/blob/master/src/videojs.hlsjs.js#L100) only Hls Runtime Events https://github.com/video-dev/hls.js/blob/master/doc/API.md#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/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Peer5/videojs-contrib-hls.js/issues/26#issuecomment-351422962, or mute the thread https://github.com/notifications/unsubscribe-auth/AEQrunncNiR5oNkJgpD3_kPXPal8od0Mks5s_-uggaJpZM4N8doV .