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

Fixed audio not looping occasionally #1225

Merged
merged 1 commit into from
Nov 22, 2019
Merged

Fixed audio not looping occasionally #1225

merged 1 commit into from
Nov 22, 2019

Conversation

themoonrat
Copy link
Contributor

Finally upgrade to the latest Howler after sitting on a version from early 2018 for ages!

I can across a bug in games where the background audio would sometimes not loop. Sometimes it did, and I couldn't work out why and when it sometimes did work and sometimes didn't. When setting a breakpoint around this area, the background looping always worked, which made things even more infuriating.

Eventually I came to this simple change. If you play a sound, and it doesn't have the looping property set, but then set it straight after playing; well, it appears there's this tiny race condition. It's something like this:
You play the audio, and when getting the id back, you set the audio to pause. But web audio isn't ready yet; so when it finally IS ready setParams is called later on than usual, and resets the loop property to it's original value of false.

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