hls.js icon indicating copy to clipboard operation
hls.js copied to clipboard

Trigger an event when a stall is resolved

Open toschlog opened this issue 4 years ago • 3 comments

Is your feature request related to a problem? Please describe.

My player puts up a "Buffering..." message when it gets a BUFFER_STALLED_ERROR. But I have no idea when to stop drawing the error because there's no event when the stall is resolved.

Describe the solution you'd like

In gap-controller.ts in the function poll(), trigger an event right after this.stallReported is set to false. Something like this:

this.trigger(Events.STALL_RESOLVED);

` I'd be happy to do this myself if that's cool.

Thanks.

Additional context

No response

toschlog avatar Aug 18 '21 20:08 toschlog

Or will the video element 'playing' event be triggered when the stall is resolved? I looked at the code and it doesn't seem like it would.

toschlog avatar Aug 18 '21 21:08 toschlog

@toschlog "waiting" signals when the video element is trying to play but it cannot (this is not just on stalls, but also when loading or seeking). The "canplay" event signals that there is enough buffer for playback to resume. You can also poll the video element readyState as these events fire when that state changes. readyState was sometimes incorrect in IE under certain circumstances, but hopefully that is no longer a concern.

robwalch avatar Aug 30 '22 20:08 robwalch

When considering this feature, see comments in #4028 for implementation details (gap-controller) and concerns related to HTMLMediaElement "waiting" and "canplay" events.

robwalch avatar Aug 30 '22 20:08 robwalch