Quick answer: play() on an <audio> or <video> element returns a promise that settles when playback has started. Calling pause(), load() or changing src before then rejects it with an AbortError. Keep the promise and pause only after it resolves, catch AbortError by name without hiding NotAllowedError, and move sound effects to a pool of elements or to Web Audio buffers.
The message shows up in the console of almost every HTML5 game that plays audio through media elements, usually on a scene change or when a sound effect fires twice in quick succession. Most of the time the sound was meant to stop and it did, so the game looks fine. The cost is elsewhere: an unhandled rejection in every session, code after an awaited play() that never runs, and a real autoplay failure buried under the noise. Below are the situations that trigger it in games and five fixes, from a three-line change to replacing the media element.
- The exact error
- What causes it in a game
- When it is harmless and when it is not
- How to find the call that interrupts
- Fix 1: pause only after play() has settled
- Fix 2: a wrapper that tracks the desired state
- Fix 3: handle the rejection by name
- Fix 4: pool audio elements for sound effects
- Fix 5: use Web Audio buffers for effects
- What Phaser and Howler do for you
- How to confirm the fix
- Seeing which audio errors reach players
- Related guides
- Frequently asked questions
The exact error
Chrome and other Chromium browsers print one of these, depending on what interrupted the request. Newer versions show the error name where older ones show DOMException, and the message usually ends with a link to Google’s explanation:
Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause().
Uncaught (in promise) AbortError: The play() request was interrupted by a call to pause().
Uncaught (in promise) DOMException: The play() request was interrupted by a new load request.
Uncaught (in promise) DOMException: The play() request was interrupted because the media was removed from the document.
Firefox and Safari report the same condition with their own wording:
DOMException: The fetching process for the media resource was aborted by the user agent at the user's request.
AbortError: The operation was aborted.
All of them are a DOMException whose name is "AbortError". HTMLMediaElement.play() returns a promise. It resolves when playback has begun, which needs enough data to be loaded and decoded, so on a slow connection the promise can stay pending for seconds. If the element is paused, reloaded or detached in that window, the browser rejects the promise. “Uncaught (in promise)” means nothing was listening for the rejection.
What causes it in a game
- Stopping music right after starting it. The menu scene calls
music.play(), the player clicks Start before the track has buffered, and the scene teardown callsmusic.pause(). The same happens when a “stop all audio” helper runs at the top of every scene. - Retriggering a sound effect on one element.
sfx.pause(); sfx.currentTime = 0; sfx.play();on every shot. The second shot’spause()lands while the first shot’splay()is still pending. Restarting withsfx.load()gives the “new load request” variant. - Switching tracks by changing
src. Assigning a newsrcruns the load algorithm, which rejects any pendingplay()on that element. - Pausing everything on
visibilitychangeorblur. The player tabs away during a loading screen, the handler pauses every element, and whichever ones were still starting reject. - Skipping a video cutscene. The skip handler pauses the
<video>, clears itssrcor removes it from the page before the first frame has played. Removing it produces the “removed from the document” variant. - The play-then-pause unlock trick. Code that calls
el.play(); el.pause();inside the first tap to unlock audio on mobile interrupts itself every time.
When it is harmless and when it is not
If the sound was supposed to stop, the rejection is only noise. It becomes a bug in two cases. The first is code that awaits the promise: in await video.play(); showSubtitles(); startCutsceneTimer(); a rejection throws out of the function, the two calls after it never run, and a skipped cutscene leaves the game on a black screen. The second is a handler that discards every rejection to make the console quiet. That also discards NotAllowedError, the autoplay policy refusing to play at all, and then you have silent music with no error anywhere. That failure has its own guide: play() failed because the user didn’t interact with the document first.
How to find the call that interrupts
The exception is created by the browser, so its stack does not point at your pause(). To see who is calling what, paste this into the console (or load it before your game code in a debug build) and reproduce the error:
for (const name of ["play", "pause", "load"]) {
const original = HTMLMediaElement.prototype[name];
HTMLMediaElement.prototype[name] = function (...args) {
console.log(name, this.currentSrc || this.src, performance.now().toFixed(1));
console.trace();
return original.apply(this, args);
};
}
Each call now logs the method, the file and a timestamp with a stack trace. Look for a pause or load on the same file a few milliseconds after a play. Assignments to src do not go through these methods, so if nothing shows up, search your code for .src =. To see how often it happens in the wild, log event.reason.name from an unhandledrejection listener; window.onerror vs unhandledrejection explains why promise rejections never reach window.onerror.
Fix 1: pause only after play() has settled
Keep the promise that play() returns, and chain the pause onto it:
const music = new Audio("audio/menu.ogg");
music.loop = true;
let musicStarted = Promise.resolve();
function enterMenu() {
musicStarted = music.play();
musicStarted.catch((err) => console.warn("menu music:", err.name));
}
function startGame() {
// Pauses once playback has begun, or at once if it already has.
// If play() was rejected, nothing is playing and there is nothing to pause.
musicStarted.then(() => music.pause(), () => {});
}
The same pattern repairs the unlock trick: el.play().then(() => el.pause(), () => {}). This fix is enough for one track with one start and one stop. It falls short when play and pause requests arrive in any order, which is what the next fix handles.
Fix 2: a wrapper that tracks the desired state
Record what the game wants (playing or not) separately from what the element is doing, and reconcile when the pending request settles. Scene code, the pause menu and the visibility handler can then call play() and pause() freely.
class MusicTrack {
constructor(src) {
this.el = new Audio(src);
this.el.loop = true;
this.el.preload = "auto";
this.wantPlaying = false;
this.pending = null;
}
// Resolves true when playing, false when the request was cancelled.
// Rejects for real failures such as NotAllowedError.
play() {
this.wantPlaying = true;
if (this.pending) return this.pending;
this.pending = this.el.play().then(
() => {
this.pending = null;
if (!this.wantPlaying) this.el.pause();
return this.wantPlaying;
},
(err) => {
this.pending = null;
if (err.name === "AbortError") return false;
throw err;
}
);
return this.pending;
}
pause() {
this.wantPlaying = false;
if (!this.pending) this.el.pause();
}
}
pause() never touches the element while a play request is in flight; it only changes the wanted state, and the then callback applies it. Give each track its own element. Swapping src on a shared one reintroduces the “new load request” rejection.
Fix 3: handle the rejection by name
Some interruptions are outside your control (the browser pausing background media, a library touching the element). Every play() call should have a handler, and the handler should sort the three errors apart:
function playSafely(el) {
const started = el.play();
if (started === undefined) return; // very old browsers return nothing
started.catch((err) => {
if (err.name === "AbortError") return; // interrupted on purpose
if (err.name === "NotAllowedError") { // autoplay policy: needs a gesture
playOnNextGesture(el);
return;
}
console.error("audio failed:", el.currentSrc || el.src, err);
});
}
function playOnNextGesture(el) {
const resume = () => {
window.removeEventListener("pointerdown", resume);
window.removeEventListener("keydown", resume);
playSafely(el);
};
window.addEventListener("pointerdown", resume);
window.addEventListener("keydown", resume);
}
Whatever is left after those two branches is usually NotSupportedError: a missing file, a wrong MIME type or a codec the browser cannot decode. Never write .catch(() => {}) on a play() you expect to be audible.
Fix 4: pool audio elements for sound effects
One element can play one sound at a time, so retriggering it means cutting it off. Create several elements per effect and rotate through them. Restart a voice by setting currentTime, which does not reject a pending play(); avoid pause() and load() entirely.
class SfxPool {
constructor(src, size = 4) {
this.voices = Array.from({ length: size }, () => {
const el = new Audio(src);
el.preload = "auto";
return el;
});
this.next = 0;
}
play(volume = 1) {
const el = this.voices[this.next];
this.next = (this.next + 1) % this.voices.length;
el.volume = volume;
el.currentTime = 0;
playSafely(el);
}
}
const laser = new SfxPool("audio/laser.wav", 6);
Size the pool to the number of overlapping copies you need. Media elements are not built for this job: start latency varies by browser, and some mobile browsers limit how many can play at once.
Fix 5: use Web Audio buffers for effects
The Web Audio API is the right tool for short, frequent sounds. A decoded buffer starts synchronously, any number of copies can overlap, and there is no play promise to interrupt.
const ctx = new AudioContext();
const buffers = new Map();
async function loadSound(name, url) {
const res = await fetch(url);
if (!res.ok) throw new Error(`audio ${url}: HTTP ${res.status}`);
const data = await res.arrayBuffer();
buffers.set(name, await ctx.decodeAudioData(data));
}
function playSound(name, volume = 1) {
const buffer = buffers.get(name);
if (!buffer) return null;
const source = ctx.createBufferSource();
const gain = ctx.createGain();
source.buffer = buffer;
gain.gain.value = volume;
source.connect(gain).connect(ctx.destination);
source.start();
return source; // call source.stop() to cut it short
}
An AudioContext created before a user gesture starts suspended, so call ctx.resume() from the first click or key press. Decoded audio is held in memory uncompressed, which is fine for effects and expensive for long music tracks. A common split is Web Audio for effects and a streaming media element, wrapped as in Fix 2, for music.
What Phaser and Howler do for you
Both default to Web Audio, where this error cannot occur. Phaser 3 falls back to an HTML5 Audio sound manager when Web Audio is unavailable or when the game config disables it, and Howler uses media elements for any sound created with html5: true (the usual choice for streaming long tracks). In those modes the libraries manage the play promise themselves, and Howler queues a pause or stop requested during a pending play until it settles.
If you see the error in a Phaser or Howler game, check three things: whether you are in HTML5 audio mode without meaning to be, whether the library version is old, and whether the element is one you created yourself beside the engine. The usual culprit is a hand-made <video> for a cutscene or an <audio> tag in the page.
How to confirm the fix
The race depends on load time, so a warm cache on localhost hides it. In Chrome DevTools open Network, tick Disable cache, set throttling to a slow profile, and then: start the game and leave the menu immediately, hold the fire key, switch tabs during the loading screen, and skip each cutscene on its first frame. The console should show no AbortError, and music should still start after the first click on a fresh page load. Repeat on a phone, where buffering is slower.
Seeing which audio errors reach players
An unhandled play() rejection is an unhandledrejection event, and Bugnet.init() in the Web SDK listens for those by default. Each distinct error is filed once per session with the last 50 console lines, a screenshot of the game canvas, the user agent and the game version, and reports with the same title stack into one entry with an occurrence count.
So before the fixes above, this AbortError shows up as one entry with a large count. After them, what remains in the audio entries is what you need to see: NotAllowedError and NotSupportedError from browsers you do not own. The limit is the one the console has too: the browser creates the exception, so the report cannot name the line that called pause(). Logging your own audio calls gives the attached console lines something to show.
Related guides
- How to Fix “DOMException: play() failed because the user didn’t interact with the document first” in Web Games
- window.onerror vs unhandledrejection: Catching Every JavaScript Error in an HTML5 Game
- How to Fix a Web Game Where the Audio Context Stays Suspended on Mobile
- How to Fix Web Audio Glitching When Switching Tabs
- How to Fix “Unable to decode audio data” Errors in Web Games
Frequently asked questions
What does “The play() request was interrupted by a call to pause()” mean?
The play method on an audio or video element returns a promise that resolves when playback has started. Your code called pause on the same element before that happened, so the browser rejected the promise with an AbortError. Nothing listened for the rejection, so it was logged as uncaught.
Is the play() interrupted error harmful?
Usually the sound was meant to stop, so nothing audible breaks. It becomes a bug when code awaits the play promise, because the rejection skips everything after the await, and when a catch-all handler added to hide it also hides autoplay failures.
How do I stop the AbortError when I pause audio quickly?
Store the promise returned by play and call pause in its then callback, so the pause runs after playback has begun. For audio that starts and stops from many places, wrap the element in a small class that records the desired state and applies it when the pending play settles.
Should I just catch and ignore the play() promise rejection?
Only ignore rejections whose name is AbortError. A NotAllowedError means the browser’s autoplay policy blocked playback and you need a user gesture, and a NotSupportedError means the file is missing or cannot be decoded. Ignoring those leaves the game silent with no error.
Does the Web Audio API have this problem?
No. An AudioBufferSourceNode starts and stops synchronously and returns no promise, so there is nothing to interrupt. That is one reason game audio libraries such as Howler and Phaser’s sound manager use Web Audio by default and keep media elements as a fallback or for streaming.
Never touch a media element while its play() promise is pending: store the promise, apply the pause when it settles, and sort rejections by name so AbortError is ignored and NotAllowedError is not.