Skip to content

fix(sdk-recorder): honor recording limits in React - #2736

Merged
richiemcilroy merged 3 commits into
CapSoftware:mainfrom
AksharP5:fix/sdk-react-recording-limit
Oct 20, 2026
Merged

richiemcilroy merged 3 commits into
CapSoftware:mainfrom
AksharP5:fix/sdk-react-recording-limit

Conversation

@AksharP5

@AksharP5 AksharP5 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

React SDK recordings ignore custom length limits and use the four-hour default. The hook now passes maxDurationMs when starting a recording. The limit is captured before permission acquisition; later prop changes preserve the active recorder and its deadline.

Closes #2735

Before and after

Same React 19.2.8 / Chrome 154 Linux workflow on main b6a06a0a5, with maxDurationMs: 1500, camera-mode canvas capture and intercepted upload requests:

Observation Main This PR
Scheduled recording deadline 14400000 ms 1500 ms
Phase observed at 2.4 seconds recording, manual stop needed complete, automatically stopped
Native automatic stop Did not happen within 2.4 seconds Approximately 1.5 seconds

The direct CapRecorder control already stops at 1.5 seconds on main. The defect is in the React wrapper.

Validation

  • bun test packages/sdk-recorder/__tests__/duration-limit.test.ts: four tests pass for the default deadline, constructor configuration, a per-start override and an explicit zero limit. The override cases fail against the previous implementation. Uses the existing Bun runtime without adding dependencies.
  • Real React DOM and browser MediaRecorder checks pass for the configured limit, the unchanged four-hour default, a limit changed to 700 ms before starting, and a rerender with equivalent options. The changed limit stops at approximately 700 ms. All capture tracks end after completion.
  • Changing the limit during recording, while paused, during permission acquisition and during upload preserves the recording and completes the upload. In the recording/paused cases, the source track remains live after the prop update and capture ends at the original 1.5-second deadline.
  • The review reproduction changes the limit from 1500 to 700 ms after 300 ms of recording. The initial PR head stops capture at 301 ms, uploads zero bytes and leaves a stale recording phase. This revision keeps capture alive, uploads a 47,890-byte recording and reports complete. Its saved file contains frames through 1.469 seconds; the paused case contains frames through 1.409 seconds. Both decode without errors.
  • Baseline and patched VP9 WebM recordings decode fully with FFmpeg. In the saved comparison, the baseline records frames through 2.369 seconds before manual stop; the patch records through 1.469 seconds before automatic stop.
  • Scoped Biome 2.2.0, git diff --check and a browser bundle build pass. Calls to CapRecorder.start() without an override retain their existing constructor limit.
  • Strict TypeScript checking of the hook and its imports reports the same pre-existing TS2345 at src/index.ts:87 on main and this patch, in event-listener unsubscribe typing. No unrelated type changes are included. Full workspace checks were not run locally.

The browser uses synthetic capture input and stubbed network requests. Physical cameras, native permission prompts, React 18, Firefox, Safari and cloud uploads remain unverified.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues were found.

Summary

React recordings now pass maxDurationMs to CapRecorder.start() instead of rebuilding the recorder when the limit changes.

  • React recordings stop at the duration set for each start.

Reviews (2) · Last reviewed commit: "fix(sdk-recorder): preserve capture when..." · Reviewed by Greptile

@vercel
vercel Bot temporarily deployed to Preview – cap-status October 20, 2026 05:08 Inactive
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Skipped Skipped Oct 20, 2026 7:42pm UTC

Comment thread packages/sdk-recorder/src/react/useCapRecorder.ts Outdated
@vercel
vercel Bot temporarily deployed to Preview – cap-status October 20, 2026 05:28 Inactive
@AksharP5

Copy link
Copy Markdown
Contributor Author

@greptileai please re-review 8c17d5b.

The limit is now captured when start() is invoked. Updating the React prop no longer recreates or destroys a recording. Browser regression checks preserve capture and completion when the limit changes during recording, while paused, during permission acquisition and during upload. Four focused deadline tests pass, and the updated PR description includes the reproduced data loss and the corrected output.

@vercel
vercel Bot temporarily deployed to Preview – cap-status October 20, 2026 19:42 Inactive
@richiemcilroy
richiemcilroy merged commit 77bc3c5 into CapSoftware:main Oct 20, 2026
28 of 29 checks passed

This branch was previously deployed

1 inactive deployment
Preview – cap-status — 70805272 Deployed Oct 20, 2026 by vercel[bot]
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.

React recording hook ignores maxDurationMs

2 participants