Skip to main content

React — Recording control

Control session replay recording and event flushing. Access these methods via useSignal().

Accessing the methods

Get recording control methods from useSignal():

startRecording()

Start session replay recording. Returns a Promise. When to use: Manually start recording if autoStart is false in SignalProvider, or restart recording after stopping.

stopRecording()

Stop session replay recording. Stops rrweb recorder, network capture, and console capture. When to use: Stop recording when the user navigates away or when you want to disable tracking temporarily.

pauseRecording()

Pause recording temporarily. Events are not captured while paused. When to use: Pause recording for sensitive operations (e.g. payment forms, password entry) without fully stopping.

resumeRecording()

Resume recording after pausing. When to use: Resume recording after a sensitive operation is complete.

flush()

Flush all queued events to the server immediately. Returns a Promise. When to use: Before page unload, before navigation, or when you need to ensure events are sent immediately.

Example: Conditional recording

See also