videojs / videojs-errors

A video.js plugin that displays error messages to video viewers.
Other
87 stars 29 forks source link

fix: show spinner if player has stalled #104

Closed forbesjo closed 7 years ago

forbesjo commented 7 years ago

Description

Currently the player relies on the tech to trigger waiting and show the spinner, however it looks like waiting is followed by a timeupdate which causes the spinner to be cleared.

This change will cause a spinner to show if the player hasn't made progress for 1 second regardless of whatever the tech does.

Requirements Checklist

forbesjo commented 7 years ago

A more general/better approach would be to deal with https://github.com/videojs/video.js/blob/master/src/js/player.js#L1192 in some way. As mentioned in the OP there is an additional timeupdate event after waiting coming from the video element (this is from a test using contrib-hls and listening to the video element directly). So you only see the waiting spinner for a brief moment.

gkatsev commented 7 years ago

@forbesjo do we know why we are getting the extra timeupdate event? Is it from the manual timeupdate tracking?

forbesjo commented 7 years ago

I'm not sure why, the event is coming from the video element itself and not the synthetic timeupdates

forbesjo commented 7 years ago

Perhaps the function should check readyState before removing the waiting CSS?