You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR addresses issue SABLE-3B, where NotAllowedError was being thrown by audioElement?.play() calls in src/app/pages/client/ClientNonUIFeatures.tsx (lines 200 and 274) and resulting in unhandled promise rejections.
The root cause was that these specific play() calls lacked a .catch() handler. Browsers like Safari reject the promise returned by play() with a NotAllowedError when autoplay is blocked due to the absence of a recent user gesture. This unhandled rejection was being reported as an error.
The fix involves adding .catch(() => {}) to both instances of audioElement?.play() in ClientNonUIFeatures.tsx. This aligns the behavior with other play() calls in the codebase (e.g., in useVoiceRecorder.ts, useCallSignaling.ts) that already gracefully handle this scenario by silently swallowing the rejection. The intended behavior remains unchanged: if autoplay is blocked, the sound simply won't play, but no unhandled error will occur.
Fixes SABLE-3B
Type of change
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to not work as expected)
This change requires a documentation update
Checklist:
My code follows the style guidelines of this project
I have performed a self-review of my own code
I have commented my code, particularly in hard-to-understand areas
I have made corresponding changes to the documentation
My changes generate no new warnings
AI disclosure:
Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
Fully AI generated (explain what all the generated code does in moderate detail).
This pull request does not include a changeset. Please add one before requesting review so the change is properly documented and included in the release notes.
How to add a changeset:
Run pnpm run document-change (interactive) and commit the generated file, or
Manually create .changeset/<descriptive-name>.md:
---default: patch---
Short user-facing summary of the change.
Replace patch with major, minor, patch, docs, or note as appropriate.
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR aims to prevent unhandled promise rejections caused by HTMLMediaElement.play() failing with NotAllowedError (e.g., autoplay restrictions) in ClientNonUIFeatures.tsx, aligning notification-sound playback behavior with other parts of the codebase.
Changes:
Added promise rejection handling to two notification-sound audioElement.play() calls.
Ensured invite and message notification sound playback no longer produces unhandled rejections when playback is blocked.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses issue SABLE-3B, where
NotAllowedErrorwas being thrown byaudioElement?.play()calls insrc/app/pages/client/ClientNonUIFeatures.tsx(lines 200 and 274) and resulting in unhandled promise rejections.The root cause was that these specific
play()calls lacked a.catch()handler. Browsers like Safari reject the promise returned byplay()with aNotAllowedErrorwhen autoplay is blocked due to the absence of a recent user gesture. This unhandled rejection was being reported as an error.The fix involves adding
.catch(() => {})to both instances ofaudioElement?.play()inClientNonUIFeatures.tsx. This aligns the behavior with otherplay()calls in the codebase (e.g., inuseVoiceRecorder.ts,useCallSignaling.ts) that already gracefully handle this scenario by silently swallowing the rejection. The intended behavior remains unchanged: if autoplay is blocked, the sound simply won't play, but no unhandled error will occur.Fixes SABLE-3B
Type of change
Checklist:
AI disclosure:
Fixes SABLE-3B