Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add synthetic stalls #4600

Open
wants to merge 8 commits into
base: development
Choose a base branch
from

Conversation

tom-coward
Copy link

Introduces optional (behind a setting defaulted off) synthetic stall functionality, which ensures all playback stops if one stream source buffer runs empty and stalls.

On a stall (setStallState() call in VideoModel), if synthetic stall events are enabled once the video element is in a ready state we will:

  • Set the video element's playback rate to 0
  • Emit a waiting event

Once a stall ends and the video element is in a ready state we will:

  • Set the video element's playback rate to its previous value (or 1 if no previous)
  • Emit a playing event

We found that some devices can break when the playback rate is set to 0 when a media buffer is empty, so will by default only perform synthetic stalls when the video element is in ready state HAS_FUTURE_DATA or higher; this can be overridden by setting the ignoreReadyState setting, which will cause synthetic stalls to occur regardless of the video element's ready state.

As general housekeeping we've also switched VideoModel.setPlaybackRate() to use the shared waitForReadyState() method.

tom-coward and others added 7 commits October 16, 2024 14:28
* also moves synthetic stall settings into syntheticStallEvents object

Co-authored-by: Eirik Bjornerstedt <[email protected]>

Co-authored-by: Joanne Monaghan <[email protected]>
* replaces listening for an canplay event manually, as has been done in other parts of VideoModel

Co-authored-by: Eirik Bjornerstedt <[email protected]>

Co-authored-by: Joanne Monaghan <[email protected]>
@tom-coward tom-coward marked this pull request as ready for review October 18, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant