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
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:
co-authored by
Claude Opus 5.5
parent
343de27cad
commit
23649f1255
@@ -259,7 +259,9 @@ function InviteNotifications() {
|
||||
|
||||
const playSound = useCallback(() => {
|
||||
const audioElement = audioRef.current;
|
||||
audioElement?.play();
|
||||
// Rejects under the autoplay policy until the user has interacted with the
|
||||
// page (e.g. messages arriving right after launch); nothing to do then.
|
||||
audioElement?.play().catch(() => undefined);
|
||||
}, []);
|
||||
|
||||
// Arm once the client's initial sync has settled (+ a short grace so the async
|
||||
@@ -572,7 +574,9 @@ function MessageNotifications() {
|
||||
|
||||
const playSound = useCallback(() => {
|
||||
const audioElement = audioRef.current;
|
||||
audioElement?.play();
|
||||
// Rejects under the autoplay policy until the user has interacted with the
|
||||
// page (e.g. messages arriving right after launch); nothing to do then.
|
||||
audioElement?.play().catch(() => undefined);
|
||||
}, []);
|
||||
|
||||
// Shared delivery tail for both the main timeline and per-thread paths:
|
||||
|
||||
Reference in New Issue
Block a user