fix(media): catch autoplay rejections from play()
CI / Build & Quality Checks (push) Successful in 5m10s
CI / Docker image build & smoke test (push) Skipped
CI / Trigger Desktop Build (push) Successful in 7s
CI / Secret scan (gitleaks) (push) Canceled after 0s
CI / Playwright smoke (e2e) (push) Canceled after 0s

Notification sounds called `audio.play()` without handling the promise,
so every message that arrived before the user interacted with the page
(e.g. right after launch) logged an uncaught NotAllowedError — 15 in a
short test run. Same pattern in the video thumbnail loader, the voice
preview (which now also resets its Play button) and useMediaPlay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
Lotus CI
2026-09-23 19:48:29 -04:00
co-authored by Claude Opus 5.5
parent 343de27cad
commit 23649f1255
4 changed files with 11 additions and 5 deletions
+3 -1
View File
@@ -134,7 +134,9 @@ export const loadVideoElement = (url: string): Promise<HTMLVideoElement> =>
video.src = url;
video.load();
video.play();
// Only nudges the decoder toward the first frame; `onloadeddata` settles
// the promise, so an autoplay refusal here is harmless.
video.play().catch(() => undefined);
});
export const getThumbnailDimensions = (width: number, height: number): [number, number] => {