-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Conversation
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. |
Do you have sample code that demonstrates this issue? |
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. |
The second PR problem concerning mute can be demonstrated here: |
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. |
Proper fix for goldfire#714
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.