From 0c76b200cc68c59772df930acd34a58bd6272c7f Mon Sep 17 00:00:00 2001 From: David Skoland Date: Sat, 7 Feb 2026 13:10:27 +0100 Subject: Catch rejected play() promises from browser autoplay policy Browsers reject .play() with a DOMException when the user hasn't interacted with the document yet. Add .catch(() => {}) to all 9 play() call sites to suppress the uncaught promise rejection. Co-Authored-By: Claude Opus 4.6 --- webAO/client/checkCallword.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webAO/client') diff --git a/webAO/client/checkCallword.ts b/webAO/client/checkCallword.ts index b7413f7..795eac9 100644 --- a/webAO/client/checkCallword.ts +++ b/webAO/client/checkCallword.ts @@ -11,7 +11,7 @@ export function checkCallword(message: string, sfxAudio: HTMLAudioElement) { if (item !== "" && message.toLowerCase().includes(item.toLowerCase())) { sfxAudio.pause(); sfxAudio.src = `${AO_HOST}sounds/general/sfx-gallery.opus`; - sfxAudio.play(); + sfxAudio.play().catch(() => {}); } } } -- cgit