Business FAQs

How to fix suspended AudioContext in Phaser games on mobile browsers?

0
(0)

Mobile browsers create every AudioContext in a suspended state until a user gesture. Call resume() on Phaser’s sound manager AudioContext inside a click/tap/pointerdown handler; Phaser already tries this on the first gesture, but you must add your own resume call if the game boots with audio silent.

At a glance

Fact Value Source
New AudioContext state on creation suspended w3.org
What resumes a suspended context user gesture + resume() developer.chrome.com
Phaser’s own autoplay handling resumes on first tap/click docs.phaser.io

A Phaser game on mobile shows silent audio because the browser’s autoplay policy creates the AudioContext in a suspended state and only a user gesture can move it out of that state – a newly-created AudioContext always begins suspended. Phaser’s WebAudioSoundManager already tries to resume the context after the first tap or click, but on some mobile browsers you still need to call resume() yourself inside a gesture handler, per Chrome’s autoplay policy guidance.

When testing mobile web builds, Playgama MCP lets an AI agent publish a test sandbox link directly from your editor.

this.input.once('pointerdown', () => {
 if (this.sound.context.state === 'suspended') {
 this.sound.context.resume();
 }
 this.sound.play('bgm');
});

Checklist:

  • Confirm the game uses Web Audio.
  • Add a resume call bound to the very first pointerdown/click/touchend on the page, not just inside a menu button.
  • If the game reloads inside a single-page app without a real page refresh, reuse the existing AudioContext instead of creating a new one each time.
  • Remember mobile browsers can also ignore preload and autoplay attributes and may disable programmatic volume control, so test actual playback, not just the context state.

Does this differ when the game runs in an iframe?

The same-origin autoplay exemption in Chrome’s policy does not apply across an iframe boundary from a different site, so the gesture-then-resume pattern above is the safe approach regardless of where the game is embedded.

Sources

Why does audio work on desktop but not on mobile in the same Phaser build?

Desktop browsers often resume audio more permissively; mobile browsers enforce the suspended-until-gesture rule more strictly and may also ignore preload/autoplay attributes on media elements.

Should I create a new AudioContext every time my game restarts?

No. Reuse the existing AudioContext, especially in single-page apps that never fully refresh the page – creating a new one each time can leave old contexts suspended and wastes resources.

Does Web Audio API work on all mobile browsers?

It is supported across all modern desktop and mobile browsers except Opera Mini, according to MDN’s Web Audio for Web games guide.

Last updated: 30 September 2026


How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Your email address will not be published. Required fields are marked *

Games categories