Skip to content

Recorder: Stop recording when tab sharing ends#6853

Merged
JonnyBurger merged 1 commit intomainfrom
fix/recorder-stop-on-tab-unshare
Mar 17, 2026
Merged

Recorder: Stop recording when tab sharing ends#6853
JonnyBurger merged 1 commit intomainfrom
fix/recorder-stop-on-tab-unshare

Conversation

@JonnyBurger
Copy link
Copy Markdown
Member

Summary

  • Fixes Remotion Recorder: If "Stop Sharing Tab" is clicked first, the recording cannot be stopped #6844: If "Stop Sharing Tab" is clicked in Chrome during a recording, the recording now automatically stops
  • The MediaRecorder is stopped immediately in the track ended event handler (inside startMediaRecorder) to prevent corrupt timestamps in the output file
  • stopAndWaitUntilDone is now idempotent — multiple calls return the same promise, so the React state transition in RecordButton works cleanly even though the recorder is already stopped

Test plan

  • Start a recording that includes a shared tab (with audio)
  • Click "Stop Sharing Tab" on the shared tab in Chrome
  • Verify the recording stops automatically and produces a valid video
  • Verify normal stop-recording flow still works as before

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment Mar 17, 2026 3:21pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
remotion Skipped Skipped Mar 17, 2026 3:21pm

Request Review

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is correct and handles the tab-sharing-end scenario well.

Key points:

  • Idempotency pattern in stopRecorder (caching stoppedPromise) prevents race conditions when both the track-ended handler and React's cleanup effect try to stop the recorder
  • Moving recorder.stop() after event listener setup ensures final data is captured before stopping
  • The once: true option on track listeners correctly limits each listener to firing once

No issues found. This cleanly addresses issue #6844.

Pullfrog  | View workflow runpullfrog.com𝕏

@JonnyBurger JonnyBurger changed the title template-recorder: Stop recording when tab sharing ends Recorder: Stop recording when tab sharing ends Mar 17, 2026
@JonnyBurger JonnyBurger merged commit 2833edd into main Mar 17, 2026
15 checks passed
@JonnyBurger JonnyBurger deleted the fix/recorder-stop-on-tab-unshare branch March 17, 2026 15:59
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.

Remotion Recorder: If "Stop Sharing Tab" is clicked first, the recording cannot be stopped

1 participant