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

Feature: add eager playback global option #1591

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

Conversation

jbgomez
Copy link

@jbgomez jbgomez commented Apr 17, 2022

Issue/Feature

Add eagerPlayback global option to force _canPlayEvent to be set to canplay. Useful for when business logic dictates that immediate playback takes precedence over potential audio buffering.

Additionally, using canplay exposes what seems to be a Chromium bug when setting currentTime on the node to the same value it's already set to. This bug is mitigated in this branch by wrapping the currentTime update in a conditional. See this CodePen example for a demo (see the play() function to adjust behavior): https://codepen.io/jbgomez/pen/jOYQeKQ

Related Issues

#1072

Solution

Adding opt-in eagerPlayback global option. Feature is disabled by default.

Reproduction/Testing

Can be observed by measuring "time-to-tune" between eagerPlayback modes. When enabled, audio will begin playing relatively sooner. Test cases have been updated with the ability to set global options.

Chromium bug was reproduced on Chrome in macOS and Windows 10, as well as Edge on Windows 10.

Breaking Changes

None.

@jbgomez jbgomez changed the title Feature add eager playback global option Feature: add eager playback global option Apr 17, 2022
@jbgomez
Copy link
Author

jbgomez commented Apr 17, 2022

Preview of Global Options on test page:

Screen Shot 2022-04-17 at 7 56 06 PM

Global Options are set to defaults on page load, and attached via query params, like so:
/howler/tests/core.html5audio.html?usingWebAudio=true&noAudio=false&autoUnlock=true&html5PoolSize=10&autoSuspend=true&eagerPlayback=false

@jbgomez
Copy link
Author

jbgomez commented Apr 18, 2022

Filed a Chromium bug to address the currentTime issue:

https://bugs.chromium.org/p/chromium/issues/detail?id=1317359

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