Game sound not playing on mobile
Mobile browsers refuse to play sound until the player touches the page. Start or resume your audio inside the first tap, and check the silent switch before anything else.

Key takeaways
- Browsers block sound until the player interacts. Create or resume the audio context inside a tap handler, not on page load.
- On iPhone, the ring/silent switch can mute web game audio entirely. Ask a tester to check it before you debug code.
- Audio that dies after switching apps needs to be resumed when the page becomes visible again.
If your web game is silent on phones but plays sound on a computer, the most likely cause is the browser's autoplay policy: mobile browsers do not allow a page to make sound until the player has tapped or clicked something, and an audio system that starts on page load stays locked even after they tap. On iPhone, the physical silent switch is the next suspect, because it can mute web audio completely. Both are quick to rule in or out.
Thirty-second checks before touching code
- 01Silent switch. On iPhones with a ring/silent switch, flip it to ring (no orange showing). On iPhones with an Action button, check that silent mode is off in Control Center.
- 02Volume. Press volume up while the game is open. Phones keep separate media and ringer volumes, and media volume is often at zero.
- 03The game's own toggle. Startbase games have their own sound toggle, and many games keep a mute setting between sessions. Make sure it is on.
- 04Bluetooth. Audio may be playing through headphones in another room.
- 05Tap first. Tap the screen once and wait. If sound starts after the tap, autoplay is the cause and the fix below is all you need.
The causes, most likely first
1. The audio context never got started
Most web games play sound through the Web Audio API, which runs inside an `AudioContext`. A context created before any user interaction starts in a suspended state on mobile. Some engines handle this for you; custom code often does not. The game then calls `play` on sounds that go nowhere, with no error in sight.
How to check: log `audioContext.state` on screen (a debug overlay helps, since phones have no console you can see). If it says `suspended` after you have tapped, this is the bug. The fix: call `audioContext.resume()` inside the handler for the first `pointerdown`, `touchend` or `click`, and only start music after that promise resolves. A "Tap to start" screen is the natural place: it gives the browser the gesture it needs and gives the player a moment to get ready. Note that the call must happen directly inside the event handler; doing it after an `await` or a timer can lose the gesture on some browsers.
2. The iPhone silent switch
On iOS, web audio has historically been treated like ringer sounds: when the phone is on silent, the game is silent too, while videos may still play. Many players keep their phones on silent all the time, so a large share of your mobile players may never hear your sound design. How to check: flip the switch while the game runs. The fix: there is no reliable way for a web page to override the switch, so design for it: make sure the game is fully playable without sound, and show a small "sound on?" hint on the start screen for phones.
3. Audio stops after switching apps or locking the phone
Phones suspend audio when the browser goes to the background. When the player comes back, the context may stay suspended or "interrupted" and the game is silent from then on. How to check: start the game with sound, switch to another app for ten seconds, come back. The fix: listen for the page's `visibilitychange` event; when the page becomes visible again, resume the context (inside the next tap if needed), and pause music when it is hidden so it does not keep draining the battery.
4. A file format the browser cannot play
Not every browser decodes every format. Older Safari versions, for example, could not play Ogg Vorbis files. How to check: the developer console (via remote debugging) shows a decode error, or only some sounds are missing. The fix: use widely supported formats. MP3 and AAC (`.m4a`) play everywhere; providing two formats and letting the audio library pick is the belt-and-braces approach.
5. Sounds loaded but too late
On a slow mobile connection, a 4 MB music file may still be downloading when the level starts. Effects that are loaded on first use play late or not at all. The fix: preload short effects during the start screen, keep effects small (under 50 KB each is a good starting value for short sounds), and stream or lazy-load long music tracks so they do not block the game.
6. Too many sounds at once
Creating a new HTML `<audio>` element for every coin pickup or shot can hit mobile limits, and sounds start failing or cutting each other off. The fix: play effects through Web Audio with decoded buffers, which can overlap cheaply, and cap how many copies of the same effect play at once (four is plenty for a rapid-fire sound).
7. Sound plays, but late
If effects arrive a beat after the action, check for Bluetooth headphones before blaming code: wireless audio commonly adds a noticeable delay, often in the region of 100 to 300 milliseconds, which wrecks rhythm games. With the phone speaker, late sounds usually mean the file is decoded on first play; decode effects into buffers at load time. For rhythm games, offer a calibration setting so players can offset the delay of their own headphones.
A sound setup that just works on phones
- One shared audio context for the whole game, created or resumed on the first tap.
- A start screen that requires a tap, which doubles as the moment audio starts.
- Separate music and effects volumes, saved between sessions, plus one mute button reachable during play.
- Resume on returning to the page; pause music when hidden.
- The game is fully playable on mute: visual feedback for every important sound (hits, timers, warnings).
The message to send the agent
The agent can generate sounds as well as wire them up, and it playtests in a real browser. Be specific about the device and what you tried:
The game has no sound on my iPhone (silent switch off, volume up) and on an Android phone, but sound works on desktop. Sound also dies after I switch apps and come back. Please: add a "Tap to play" start screen that resumes the shared AudioContext inside the tap handler, resume audio on visibilitychange when the page is visible again and pause music when hidden, convert all sound files to MP3, preload effects on the start screen, cap simultaneous copies of each effect at 4, and add a small "sound on?" hint for phones. Keep the game fully playable on mute.
For making the sounds themselves better, read the game sound effects guide, AI-generated sound for games and the game music guide. If taps themselves are not registering, the problem is input, covered in touch controls not responding.
Frequently asked questions
Why does my HTML5 game have no sound on iPhone?
Either the audio was never started by a tap (autoplay policy), or the phone is in silent mode, which mutes web audio. Resume the audio context inside the first tap and test with silent mode off.
Can a web game play sound without the user tapping first?
Not reliably on mobile. Browsers require a user gesture before a page can make sound. Use a tap-to-start screen.
Which audio format works on all phones?
MP3 and AAC (m4a) play in every current mobile browser. They are the safest choices for game audio.
Why does sound stop when I come back to the game?
The phone suspended the audio when the browser went to the background. Resume the audio context when the page becomes visible again.

