RoyalUr.net
RoyalUr.net copied to clipboard
Fix sound playback on mobile
The mobile client has a lot of issues with audio due to the browser requiring user interaction events to play sounds.
I think there is a workaround for this however. It seems that each interaction allows you to play one Audio object as many times as you like! Therefore, I am thinking that on each interaction with the browser we could add to a pool of Audio objects to use to play audio on mobile. Whenever we need to play a sound, we can then swap the src
of these Audio objects to the sound we want to play, and play the sound!
We could also consider using a pre-existing solution such as Howler.js.