Skip to content

Resume AudioContext on user interaction to fix Chrome audio#556

Merged
bfirsh merged 1 commit intomainfrom
bfirsh/fix-chrome-audio
Feb 15, 2026
Merged

Resume AudioContext on user interaction to fix Chrome audio#556
bfirsh merged 1 commit intomainfrom
bfirsh/fix-chrome-audio

Conversation

@bfirsh
Copy link
Owner

@bfirsh bfirsh commented Feb 15, 2026

Chrome and other browsers block AudioContext from starting until a user gesture occurs on the page. This caused no sound when navigating directly to a ROM page on jsnes.org.

The fix listens for keydown/mousedown/touchstart events and automatically calls audioCtx.resume() on the first interaction. Audio now starts seamlessly when users begin playing without requiring manual intervention.

Fixes #368

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Chrome and other browsers block AudioContext from starting until a user
gesture occurs on the page. This caused no sound when navigating directly
to a ROM page. Fix by listening for keydown/mousedown/touchstart events
and calling audioCtx.resume() on the first interaction.

Fixes #368

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bfirsh bfirsh merged commit 7468b30 into main Feb 15, 2026
5 checks passed
@bfirsh bfirsh deleted the bfirsh/fix-chrome-audio branch February 15, 2026 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sound problems

1 participant