Skip to content

feat:add ability to pause/resume recordings.#323

Open
Galactic99 wants to merge 3 commits intosiddharthvaddem:mainfrom
Galactic99:feature/add-pause-or-resume-functionality
Open

feat:add ability to pause/resume recordings.#323
Galactic99 wants to merge 3 commits intosiddharthvaddem:mainfrom
Galactic99:feature/add-pause-or-resume-functionality

Conversation

@Galactic99
Copy link
Copy Markdown

@Galactic99 Galactic99 commented Apr 4, 2026

Description

This PR adds pause and resume support during active recording in the HUD and updates recording-duration handling so paused intervals are not counted in the user-visible timer and saved recording duration.

Motivation

Users needed the ability to temporarily pause recording without ending the session and starting a new file.
This change solves that by allowing pause and resume in the same recording session, while keeping duration reporting accurate.

Type of Change

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

Related Issue(s)

#251

Screenshots / Video

Before

Before-Pause-Resume.mp4

After

After-Pause-Resume.mp4

Testing

  1. Start recording from the HUD.
  2. Record for ~5 seconds.
  3. Click Pause and wait ~5 seconds.
  4. Click Resume and record for ~5 seconds.
  5. Stop recording.
  6. Verify:
    * Timer does not advance during pause.
    * Timer resumes from previous elapsed value after resume.
    * Final saved recording duration matches active recording time (paused interval excluded).
    * Pause/resume also affects mixed audio capture during paused interval.

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 pause and resume controls for screen recordings with dedicated HUD icons and toggle behavior while recording.
    • Pause button shown only during active recording; paused recordings use amber styling for the main control.
    • Recording timer now excludes accumulated paused time, updates while unpaused, and resets when recording stops.
    • Tooltips for pause/resume added in English, Spanish, and Chinese.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 4, 2026

📝 Walkthrough

Walkthrough

Adds pause/resume recording controls and state to the recorder hook and LaunchWindow UI; elapsed recording time now excludes paused intervals; UI shows a pause/resume HUD button and applies amber styling when paused; i18n tooltips for pause/resume added.

Changes

Cohort / File(s) Summary
Recording Hook
src/hooks/useScreenRecorder.ts
Added paused, pauseRecording(), resumeRecording() to hook API; track pause start/duration; subtract paused time from persisted/final duration; stop/finalize handles "paused" state and clears pause state on errors.
Launch Window UI
src/components/launch/LaunchWindow.tsx
Consume new hook fields; add pause/resume HUD button with FaPauseCircle/FaPlayCircle; replace interval logic with paused-aware elapsed computation (250ms); track pausedAt/pausedTotalMs; reset timers when recording stops; change record button background to amber when paused.
Localization
src/i18n/locales/en/launch.json, src/i18n/locales/es/launch.json, src/i18n/locales/zh-CN/launch.json
Added tooltips.pauseRecording and tooltips.resumeRecording translations (EN/ES/ZH-CN). Minor trailing-comma formatting in some locale files.

Sequence Diagram

sequenceDiagram
    actor User
    participant LaunchWindow
    participant useScreenRecorder
    participant MediaRecorder

    User->>LaunchWindow: Click pause button
    LaunchWindow->>useScreenRecorder: pauseRecording()
    useScreenRecorder->>MediaRecorder: pause()
    useScreenRecorder->>useScreenRecorder: set paused=true<br/>record pausedStartedAt
    LaunchWindow->>LaunchWindow: swap to resume icon<br/>apply amber styling

    User->>LaunchWindow: Click resume button
    LaunchWindow->>useScreenRecorder: resumeRecording()
    useScreenRecorder->>MediaRecorder: resume()
    useScreenRecorder->>useScreenRecorder: accumulate pausedDurationMs<br/>set paused=false
    LaunchWindow->>LaunchWindow: swap to pause icon<br/>elapsed resumes (now - start - pausedTotal)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I paused the world to count a hop,
A nibble of silence—then back on top.
I press resume, the pixels sing,
Frames unfurl like a ribboned spring. 🎥⏸️▶️

🚥 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
Description check ✅ Passed The description includes all required template sections: purpose, motivation, type of change, related issues, screenshots/video, testing steps, and completed checklist.
Title check ✅ Passed The title accurately describes the main feature added: pause/resume recording capability. It directly reflects the primary change across all modified files.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@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: b4992b328a

ℹ️ 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".

Copy link
Copy Markdown

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/hooks/useScreenRecorder.ts (1)

624-628: ⚠️ Potential issue | 🟡 Minor

Restart does not work while paused.

The condition at line 628 only checks for "recording" state, but the restart button remains visible when paused. Users clicking restart while paused will see no effect.

🔧 Proposed fix to allow restart from paused state
 const restartRecording = async () => {
   if (restarting.current) return;

   const activeScreenRecorder = screenRecorder.current;
-  if (!activeScreenRecorder || activeScreenRecorder.recorder.state !== "recording") return;
+  if (
+    !activeScreenRecorder ||
+    (activeScreenRecorder.recorder.state !== "recording" &&
+      activeScreenRecorder.recorder.state !== "paused")
+  )
+    return;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/hooks/useScreenRecorder.ts` around lines 624 - 628, The restartRecording
guard currently returns unless activeScreenRecorder.recorder.state ===
"recording", which prevents restart when the recorder is paused; update the
condition in restartRecording (and any related early-return checks) to allow
both "recording" and "paused" states (e.g., proceed if state === "recording" ||
state === "paused") so a paused recorder can be restarted; ensure
restartRecording uses screenRecorder.current and restarting.current as before
and that downstream restart logic correctly handles the paused state
(resume/stop/start as appropriate).
🤖 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/components/launch/LaunchWindow.tsx`:
- Around line 485-496: The Tooltip for the resume/pause button in
LaunchWindow.tsx uses hardcoded English strings; replace the inline strings
("Resume recording"/"Pause recording") with i18n calls (e.g.,
t("tooltips.resumeRecording") and t("tooltips.pauseRecording")) so the Tooltip
content reads t(paused ? "tooltips.resumeRecording" :
"tooltips.pauseRecording"); update your translation JSON files with those keys
and values; the change should be applied where Tooltip is rendered around the
button that references recording, paused, resumeRecording, pauseRecording, and
getIcon.

---

Outside diff comments:
In `@src/hooks/useScreenRecorder.ts`:
- Around line 624-628: The restartRecording guard currently returns unless
activeScreenRecorder.recorder.state === "recording", which prevents restart when
the recorder is paused; update the condition in restartRecording (and any
related early-return checks) to allow both "recording" and "paused" states
(e.g., proceed if state === "recording" || state === "paused") so a paused
recorder can be restarted; ensure restartRecording uses screenRecorder.current
and restarting.current as before and that downstream restart logic correctly
handles the paused state (resume/stop/start as appropriate).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fc29500d-5abc-4786-a0b1-fba16dccc214

📥 Commits

Reviewing files that changed from the base of the PR and between 21893f0 and b4992b3.

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

@Galactic99 Galactic99 changed the title feat:Adds ability to pause/resume recordings. feat:add ability to pause/resume recordings. Apr 4, 2026
@Galactic99
Copy link
Copy Markdown
Author

@siddharthvaddem, could you take a look whenever you are free?

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