Skip to content

Restore desktop Safari playback after autoplay is blocked - #523

Closed
spencer-hong wants to merge 2 commits into
kernel:mainfrom
spencer-hong:codex/desktop-autoplay-recovery
Closed

spencer-hong wants to merge 2 commits into
kernel:mainfrom
spencer-hong:codex/desktop-autoplay-recovery

Conversation

@spencer-hong

@spencer-hong spencer-hong commented Nov 22, 2026 •

Copy link
Copy Markdown

Desktop Safari can connect to the live view and receive a healthy MediaStream while leaving the video black. I reproduced this with readyState: 4, live audio/video tracks, and a paused, muted video whose play() rejects with NotAllowedError. Calling play() from a real button click restored the image immediately.

The initial autoplay watcher currently pauses the store after both playback attempts fail without setting videoBlocked, so no recovery control appears. The existing resume handler also excludes desktop devices. This change exposes the existing recovery button when autoplay is refused and allows that button, keyboard input, and visibility recovery to resume video on desktop. The label becomes “Resume video” for both mouse and touch users.

Validation:

  • Added regression tests against the actual component watcher and resume handler for both initially muted and initially unmuted desktop videos.
  • All 264 client tests pass.
  • The production client build passes (existing bundle-size warnings).
  • Confirmed explicit user-gesture playback restores the affected live stream in desktop Safari, both directly and inside an iframe. The newly built provider bundle has not been deployed.

Note

Low Risk
Localized live-view playback and recovery UX in the video component; no auth, data, or infrastructure changes.

Overview
Fixes black video on desktop Safari when the stream is healthy but play() is rejected under autoplay policy.

When both normal and muted autoplay attempts fail in onPlayingChanged, the client now sets videoBlocked so the existing recovery overlay appears (previously the store paused without flipping that flag). resumeVideo no longer requires a touch device—desktop users can recover via the button, keyboard paths that call resume, and tab visibility. The control label is "Resume video" instead of touch-specific copy.

Adds video-autoplay.test.ts regression tests (muted/unmuted desktop refusal → blocked → user-gesture resume) and updates video-input.test.ts so desktop resume/visibility behavior is expected.

Reviewed by Cursor Bugbot for commit acd56a6. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

1 participant