Feature: add eager playback global option #1591
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue/Feature
Add
eagerPlayback
global option to force_canPlayEvent
to be set tocanplay
. 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 settingcurrentTime
on the node to the same value it's already set to. This bug is mitigated in this branch by wrapping thecurrentTime
update in a conditional. See this CodePen example for a demo (see theplay()
function to adjust behavior): https://codepen.io/jbgomez/pen/jOYQeKQRelated 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.