Problem with Sounds on iOS

If you are requesting technical assistance with Twine, please specify:
Twine Version: 2.2.1
Story Format: SugarCube 2.21.0

Hi Everyone
I have discovered that my twine games don’t play sounds on iOS but DO play correctly on Android and PC.
Has anyone else had this problem and if so can it be fixed?

Are you trying to play sound when the 1st Passage of your project is displayed, or sometime after the reader has transitioned off that Passage.

Most modern web-browsers (especially mobile ones) don’t allow the auto playing of audio until after the end-user has interacted with the web-page. This is why its generally recommended that the 1st Passage of your project is used as a Summary/Welcome type page, with a link to the actual starting Passage of your story/game.

Thank you for the prompt response Greyelf - I do know about the sound not working until after the reader interacts with the first passage so I do set up my stories to take that into account.
This is a case of NO sounds working when players use an iPhone but ALL sounds do work on other mobile devices and on pc.

Is the end-user able to play audio on web-pages other than your Story HTML file?

Yes - all the people who have tested games for me on iPhone (including me :blush:) can play sounds on webpages no problem. It’s really strange I must admit.

As mentioned in point 2 of SugarCube’s Audio limitations documentation, the volume of audio playback on a mobile device is controlled by that device (and it’s Operating System), not by any functionality built into the Story HTML file itself.

Is it possible that the audio settings of the device has the associated volume either set to muted, or turned down?

Are the audio files being stored on the device in a location that is relative & accessible to the Story HTML file?

Are the audio files being used of a file format type that is supported by the device?

Thanks so much for helping me with this.

I did check with people regarding mute/low volume and that was not the issue. I also tried it myself and adjusting volume made no difference.

I don’t know much about the storage of audio files on mobile phones but I do know that android systems access and play the audio files with no problem.

The files used are in mp3 format normally playable on iPhones.

Is it possible that iPhones only play games properly in app format? Although everything works ok at the moment on the iPhone - just not the audio.

In my own recent experience, I discovered near the end of the development of my own Twine/Sugarcube2 game that it didn’t work AT ALL on Safari. It would work on IOS devices, but only if the user plays it via Chrome or Firefox.

To be clear, the problem I experienced was not caused by Sugarcube, but likely by some of the many macros I created for it.

But in your case, perhaps you could ask your IOS users to play via one of the aforementioned browsers to see if it works there?

Thanks Pete
That’s certainly worth a try although Safari does run the rest of the game ok. I will ask people to try Chrome or Firefox and will try them myself.
Thanks again - will let you know.

@ Pete Gardner & Greyelf

Turns out that the same problem occurs (no sound on iphone) whatever browser is used.
This suggests a specific device issue rather than a browser problem. Unfortunately, I don’t know much about iphones or which settings might be causing the problem.

Have you checked out this solution?

SugarCube developer here.


  • What version of iOS are they using?
  • What version of SugarCube are you using?
  • In what passage are you calling <<cacheaudio>>?
  • Are you using <<waitforaudio>> to wait for the tracks you’ll be using upfront to load?
  • What does your audio initialization code look like?

I just tried an audio test project that I keep on my server on my iPhone running iOS v14.7.1 and encountered no issues playing MP3 audio in Safari and other browser shells.

EDIT: Added code question.

@Pete Gardner
Thanks Pete I did have a look at this - I must admit my games are pretty simple and I use minimal JavaScript (lack of knowledge). However, this might be a way to tackle the issue.


  • iOS - I’m not sure about my testers but mine is 14.8
  • SugarCube version is in the first post
  • I’m first calling
  • <<cacheaudio>>

in passage 4

  • I haven’t used (or heard of)
  • <<waitforaudio>>

but I’m happy to give it a try. How and when might I use it?

The <<waitforaudio>> documentation suggests calling it after <<cacheaudio>> for either all the tracks you want to play, or just the first one or two that you need. It’s possible that there’s something about iOS that the audio isn’t playing because it hasn’t loaded yet: <<waitforaudio>> will wait for all the tracks to load.

@Josh Grams
Fantastic - thanks. I’ll give it a go.

Your <<cacheaudio>> invocations really should be in your StoryInit special passage, unless you’ve disabled saves or are doing something interesting to ensure they’re loaded upon loading a save. Even if that’s the case, I’d still recommend using StoryInit.

As for your SugarCube version, you might want to update that. The current version is v2.35.0 and there have definitely been audio updates since v2.21.0—including iOS-specific fixes.

Check the Guide: Code Updates starting at the v2.28.0 entry and reading upwards to see if you need to do anything more than simply dropping the new version in.

@TheMadExile - thanks for the tip re the new SugarCube version. Will definitely get that.
With regard to <> I do actually invoke those in StoryInit - it’s actually the Play macro invoked in Passage 4 (sorry what I wrote before was unclear).
Hopefully the new SugarCube version will solve the issue without me having to do anything complicated (very bad at JavaScript lol)

1 Like

FYI - This forum tends to eat macros and HTML elements if you don’t enclose them within a “Preformatted text” block (use the “</>” button in the editor menu). You’ll need to do that if you want people to see what you’re referring to there.

Let us know how that goes.