After some googling, I figured out how to fix the sound for PICO-8 games on iOS. I wrote a small demo in this GitHub repo: https://github.com/nucleartide/fix-pico8-ios-sound
It might be that this is obvious to anyone who's experimented with PICO-8 on mobile... but lemme know what you think!
Ah ha! Well spotted, sir!
I just did a quick test on my iPhone 6 and there's sound...glorious sound!
I'm going to integrate it with my "Add to home screen" template setup and see how that goes.
Thanks for the insight into Safari...doesn't surprise me they have something like that baked in.
So as I dig in more to what you've written and trying to integrate it, finding out that I can't even simulate the click event.
I mean, the gist of what your script does it use the audioContext for the browser, but that's all just triggered by the onclick on the overlay. Doing a programmatic click() doesn't get the job done. Thought it might since we'd rather not have that "tap to load" page at all.
Any thoughts on how to get that onclick() to listen to a "fake" click? I've done some digging already but nothing has worked :(
Yeah it won't work with programmatic clicks, it has to be a real click/touch from the user. Sadly the "tap to load" is mandatory.
Check out https://paulbakaus.com/tutorials/html5/web-audio-on-ios/ for the reasoning. :)
Bummer but just something we'll deal with. I've already tweaked that overlay to see how I can use it better. Maybe just a splash screen with game art? Or an ad? Could be anything...eitherway, happy have sound in the mobile web world :)
It doesn't seem to work on iOS 10 and also only worked once for me on safari desktop :-( after that the game doesn't load at all.
EDIT: On every device I try, it loads only the first time and after that it's blank. Some people report it doesn't work on Android :-(
EDIT: My fault, I forgot to add fix-pico8-ios-sound.js to my game.manifest
Why doesn't the sound just start to work once the player taps the screen? Without needing the script. My game has touch controls and the first thing you do is tap/press through the title screen, but sound of course completely doesn't work on mobile.
Also, I am curious if any Android users know whether sound works for Pico-8 on there.
[Please log in to post a comment]