Skip to content

React recording hook ignores maxDurationMs #2735

Closed

Description

@AksharP5

Description

React integrations using @cap/sdk-recorder/react cannot enforce a custom recording length with maxDurationMs. useCapRecorder() accepts RecorderOptions but drops this field when creating CapRecorder, so it schedules the default four-hour deadline instead.

Expected: a recording configured with maxDurationMs: 1500 automatically stops after approximately 1.5 seconds.

Actual: it is still recording after 2.4 seconds and requires a manual stop. Passing the same options directly to new CapRecorder() correctly stops at 1.5 seconds. This affects integrations that need short, bounded recordings.

Reproduction

  1. Mount a React component using the exported hook with these options:
const recorder = useCapRecorder({
	publicKey: "YOUR_SDK_PUBLIC_KEY",
	apiBase: "https://cap.so",
	mode: "camera",
	camera: { enabled: true },
	microphone: { enabled: false },
	maxDurationMs: 1500,
});
  1. Call await recorder.start() from a user interaction and allow camera capture.
  2. Observe recorder.phase after 2.4 seconds. It remains recording instead of stopping at the configured deadline. Call recorder.stop() to end the reproduction.

The dropped option is in useCapRecorder.ts. The recorder constructor already supports it.

Additional Context

  • SDK version: source package 0.1.0 on current main, b6a06a0a5d2f72f16862a3955ba0ba2a298ae1d7.
  • Verified with React 19.2.8 and Chrome 154 on Linux.
  • The controlled browser reproduction uses real React DOM, canvas capture, MediaRecorder and the SDK lifecycle. Device acquisition returns a synthetic canvas and upload requests are intercepted. Physical devices and cloud uploads were not tested.
  • The baseline schedules 14400000 ms. A focused patch forwarding the option schedules 1500 ms, stops the native recorder at approximately 1501 ms and releases all capture tracks. Saved VP9 recordings decode successfully with FFmpeg.

Public issue/PR searches, including comments on the original SDK PR #1639 and the open SDK testing PRs, found no report or active work covering this React option omission. The already-reported pause-duration accounting problem is separate.

Activity

  1. linear commented on Oct 20, 2026

    @linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions