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 stalled event handler #1752

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nsw42
Copy link

@nsw42 nsw42 commented Feb 1, 2025

Feature

Makes the html5 'stalled' event visible to clients. This is mentioned in passing in #1081, and allows UIs to provide appropriate feedback if the source is no longer available (e.g. a mobile device has lost connection to the server). In such a scenario, the html5 loaderror event does not fire, but the stalled event does.

Related Issues

#1081 mentions the stalled event as a partial solution to the use case in that ticket.

Solution

The stalled event copies the pattern established by the loaderror event, with onstalled added as an option to the Howl prototype.

Reproduction/Testing

My testing consisted of a Python Flask application that served my HTML, JS and mp3 files, and dist/howler.js from this PR. This allowed the following test procedure:

  1. start the python application (on my desktop)
  2. open the page on my phone
  3. kill the Python server (with Ctrl-C)
  4. press the Play button.
    Approx 3s later (seemingly the amount of time it takes the html5 stalled event to fire), my JS application onstalled event handler was invoked, allowing the UI to update accordingly.

Breaking Changes

N/A

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