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

Check sound status before playHtml5() #714

Closed
wants to merge 2 commits into from
Closed

Check sound status before playHtml5() #714

wants to merge 2 commits into from

Conversation

Patrick-Hammond
Copy link

Playing a looped sound in IE11 (HTML audio) and stopping it again either, immediately or after a short delay, causes the sound to loop indefinitely.
I found the minimum time to safely play and stop a looping sound was about 800ms - anything less and the sound would result in the bug.
This is due to the readyState not being 4 (canPlayThrough) initially. After the readyState callback, no check is made whether the sound has been stopped in the meantime before playHtml5() is called.

I found playing the sound at least once (loop false) rather than just having silence was more desirable.

@Patrick-Hammond
Copy link
Author

Being new to Github, I wasn't sure how to separate these commits into 2 pull requests.

Check HowlerGlobal mute when creating audio context addresses the problem of the masterGain node getting reset to 1 without considering the HowlerGlobal mute state.

@goldfire
Copy link
Owner

Do you have sample code that demonstrates this issue?

@Patrick-Hammond
Copy link
Author

https://codepen.io/Colourclash/pen/YVmmeX

When running this in IE with the PR, the sound plays once and stops. Without, it just loops continuously.
It is also getting stuck in WebAudio (Chrome) which is something I didn't notice before.

@Patrick-Hammond
Copy link
Author

The second PR problem concerning mute can be demonstrated here:
https://codepen.io/Colourclash/pen/LLPwpg
This occurs only on mobile devices because _enableMobileAudio recreates the audio context without considering the mute state.
Setting device type to Mobile in Chrome dev-tools is enough to reproduce.

@goldfire goldfire closed this in 310c14a Jun 2, 2017
goldfire added a commit that referenced this pull request Jun 2, 2017
@goldfire
Copy link
Owner

goldfire commented Jun 2, 2017

Thanks for those two samples, that was a big help! I found a different approach to fixing the first issue that is more general-purpose and probably solves several other related issues. If you are still running into any of these issues let me know.

goldfire added a commit that referenced this pull request Jun 9, 2017
ringcrl pushed a commit to ringcrl/howler.js that referenced this pull request Apr 21, 2019
ringcrl pushed a commit to ringcrl/howler.js that referenced this pull request Apr 21, 2019
ringcrl pushed a commit to ringcrl/howler.js that referenced this pull request Apr 21, 2019
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.

2 participants