Skip to content

feat: Add Restart Recording Functionality#216

Merged
siddharthvaddem merged 3 commits intosiddharthvaddem:mainfrom
prayaslashkari:feature/restart-recording
Mar 17, 2026
Merged

feat: Add Restart Recording Functionality#216
siddharthvaddem merged 3 commits intosiddharthvaddem:mainfrom
prayaslashkari:feature/restart-recording

Conversation

@prayaslashkari
Copy link
Contributor

@prayaslashkari prayaslashkari commented Mar 15, 2026

Pull Request Template

Description

Adds a Restart Recording button to the HUD overlay that discards the current recording and immediately starts a new one from scratch.

Files changed:

  • src/hooks/useScreenRecorder.ts — adds restartRecording() and a discardRecording ref
  • src/components/launch/LaunchWindow.tsx — adds the restart button UI (visible only during recording)

Motivation

Users sometimes start recording accidentally or realize they need to redo the beginning (wrong window selected, not ready, etc.). Without this, they'd have to stop recording, wait for the editor to open, discard that file, go back to the HUD, and start again. The restart button short-circuits that by discarding the in-progress recording and instantly starting fresh.

Type of Change

  • New Feature
  • Bug Fix
  • Refactor / Code Cleanup
  • Documentation Update
  • Other (please specify)

Related Issue(s)

Screenshots / Video

Screenshot (if applicable):
n/a

Video (if applicable):

restart-screen-recording.mov

Testing

  1. Start a recording — click the record button (source must be selected)
  2. Verify restart button appears — a restart icon should appear next to the stop button, only while recording
  3. Click Restart — the current recording stops (discarded, no file saved), and a new recording begins immediately
  4. Verify the timer resets — elapsed time should reset to 00:00
  5. Stop the new recording normally — verify it saves and opens in the editor as expected
  6. Verify restart button disappears — once recording stops, the button should not be visible

Checklist

  • I have performed a self-review of my code.
  • I have added any necessary screenshots or videos.
  • I have linked related issue(s) and updated the changelog if applicable.

Thank you for contributing!

Summary by CodeRabbit

  • New Features
    • Added a restart button to the screen recording HUD that appears while recording, letting users restart a recording in-place without manually stopping and starting.
    • Restart flow now safely aborts the current recording and begins a fresh session to prevent overlapping or corrupted captures.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0727b61de7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

Added a restart capability to screen recording: useScreenRecorder now exposes restartRecording() (with internal discardRecording coordination) and LaunchWindow renders a restart button that invokes it during active recording.

Changes

Cohort / File(s) Summary
Recording Hook Logic
src/hooks/useScreenRecorder.ts
Added restartRecording() to the hook's public return type; introduced discardRecording to drop in-flight chunks, wait for the previous recorder to stop, and start a fresh recording session.
Recording UI Integration
src/components/launch/LaunchWindow.tsx
Imported MdRestartAlt, exposed restartRecording from the hook, added a restart button/icon to the HUD shown during active recording that calls restartRecording().

Sequence Diagram

sequenceDiagram
    actor User
    participant LaunchWindow
    participant useScreenRecorder
    participant MediaRecorder as Browser MediaRecorder

    User->>LaunchWindow: Click restart button
    LaunchWindow->>useScreenRecorder: restartRecording()
    useScreenRecorder->>useScreenRecorder: set discardRecording = true
    useScreenRecorder->>MediaRecorder: abort/stop current recording
    MediaRecorder->>useScreenRecorder: stop event
    useScreenRecorder->>useScreenRecorder: detect discardRecording, clear chunks, await stop completion
    useScreenRecorder->>MediaRecorder: start new recording
    MediaRecorder->>useScreenRecorder: new recording session active
    useScreenRecorder->>LaunchWindow: notify recording restarted
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 I nudged a tiny button, gave the old take a nudge,
Chunks tumble out, then vanish with a judge.
A fresh light flickers, recording starts anew,
Hop, click, restart — another perfect view. 🎬

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding restart recording functionality, which matches the primary objective of the pull request.
Description check ✅ Passed The description comprehensively covers all required sections: purpose, motivation, type of change, related testing steps, and a demonstration video. All essential information is present and well-structured.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/hooks/useScreenRecorder.ts`:
- Around line 380-397: restartRecording currently attaches a "stop" listener
whenever mediaRecorder.current is non-null and sets discardRecording.current
without guarding recorder state or concurrent calls, which can hang awaiting a
stop that already happened and leak discard into the next session; update
restartRecording to be single-flight by using a restarting flag (e.g.,
restarting.current) to ignore duplicate invocations, only attach the "stop"
listener if mediaRecorder.current?.state === "recording" (otherwise resolve
immediately), call stopRecording.current() only when recorder is recording,
await the resolved stop promise, clear restarting.current before/after
startRecording(), and ensure discardRecording.current is reset appropriately so
the next startRecording() isn't affected by a prior pending restart.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b70049e8-38de-4576-b06b-de96b3c134ef

📥 Commits

Reviewing files that changed from the base of the PR and between 56988e8 and 119c3ac.

📒 Files selected for processing (2)
  • src/components/launch/LaunchWindow.tsx
  • src/hooks/useScreenRecorder.ts

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/hooks/useScreenRecorder.ts (1)

44-44: Consider declaring accurate async return type.

The type declares () => void but the implementation is async, which returns Promise<void>. While startRecording handles its own errors internally so this is unlikely to cause unhandled rejections, an accurate type allows callers to properly await if needed.

♻️ Suggested type fix
-	restartRecording: () => void;
+	restartRecording: () => Promise<void>;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/hooks/useScreenRecorder.ts` at line 44, The declared type for
restartRecording is currently () => void but the implementation is async and
returns a Promise; update the type signature for restartRecording to () =>
Promise<void> (or the corresponding async function type in the hook's
return/type definition) so callers can await it; locate the restartRecording
entry in the useScreenRecorder hook's return/type and change its declaration to
Promise<void> while keeping the async implementation unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/hooks/useScreenRecorder.ts`:
- Line 44: The declared type for restartRecording is currently () => void but
the implementation is async and returns a Promise; update the type signature for
restartRecording to () => Promise<void> (or the corresponding async function
type in the hook's return/type definition) so callers can await it; locate the
restartRecording entry in the useScreenRecorder hook's return/type and change
its declaration to Promise<void> while keeping the async implementation
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e71e9a6b-7772-4876-a69d-baba2f9da1c7

📥 Commits

Reviewing files that changed from the base of the PR and between 119c3ac and e2147be.

📒 Files selected for processing (1)
  • src/hooks/useScreenRecorder.ts

@siddharthvaddem siddharthvaddem merged commit 2669b38 into siddharthvaddem:main Mar 17, 2026
5 checks passed
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.

2 participants