So I'm building this slot frontend (nothing big, just for me and 2 friends to mess around on) and everything works fine on Android. Chrome, Brave, whatever. Then I open it on my brother's iPhone and the spin sound just... doesn't play. First spin silent. Second spin silent. Then after I tap the screen somewhere random it starts working lol.
Spent like 2 hours thinking my code was broken. Turns out iOS blocks audio until there's a user gesture, which, ok, fair. But I already have a start button and I do call audio.play() inside the click handler. Still nothing on the first one. I read somewhere that you have to "unlock" the audio context on the very first touch, so now I'm doing a silent 0.1s buffer play on the start tap just to wake it up. Feels hacky but it works?
Anyone else dealt with this? Does the silent-buffer trick still work on the newer iOS versions or am I going to get yelled at by my friends again next spin? Also wondering if I should just preload everything, right now the sounds come off a CDN (I moved them there after the first version loaded like a potato, learned a lot from the Website Speed & CDN Forum honestly).
Side note, my landing page for this thing is still sitting on one of those drag and drop builders from before I started learning actual HTML. Too lazy to rebuild it.
https://websiteforums.info/forums/other-cms-and-site-builders.8/
Anyway if someone has a clean way to handle the audio unlock thing I'll take it 🙏