Skip to main content
Paid plans only useRecording(params?): Object Accepts optional callbacks for recording events. When multiple recordings are running concurrently (see multi-instance recording), you can pass an instanceId to get per-instance state. Without instanceId, the hook returns aggregate state across all instances. For a list of all active instances, see useRecordingInstances.

Parameters (optional)

An object with the following properties:
instanceId
string
A valid UUID. When provided, returns state for a specific recording instance and filters event callbacks to only fire for that instance. See multi-instance recording.
onRecordingError
Function
Callback for the recording-error event.
onRecordingStarted
Function
Callback for the recording-started event.
onRecordingStopped
Function
Callback for the recording-stopped event.

Return value

An object with the following properties:

Without instanceId (aggregate state)

When called without instanceId, the hook returns aggregate state across all recording instances. This works well for single-instance use cases — the scalar fields (layout, recordingId, etc.) reflect the only active instance. With multiple concurrent instances, these fields reflect the first active instance; use useRecording({ instanceId }) for unambiguous per-instance access.
error
boolean
true if any instance has a recording-error. With multiple instances, use useRecording({ instanceId }) for per-instance error state.
isLocalParticipantRecorded
boolean
true if the local participant is recorded by any instance.
isRecording
boolean
true if any recording instance is active.
layout
Object
Layout of the first active instance. With multiple instances, use useRecording({ instanceId }) for per-instance layout.
local
boolean
recordingId
string
Recording ID of the first active instance. With multiple instances, use useRecording({ instanceId }) for per-instance recording ID.
recordingStartedDate
Date
Start date of the first active instance. With multiple instances, use useRecording({ instanceId }) for per-instance start date.
startedBy
string
Starter of the first active instance. With multiple instances, use useRecording({ instanceId }) for per-instance starter.
startRecording
Function
See daily-js startRecording().
stopRecording
Function
See daily-js stopRecording().
type
string
Recording type of the first active instance. With multiple instances, use useRecording({ instanceId }) for per-instance type.
updateRecording
Function
See daily-js updateRecording().

With instanceId (per-instance state)

When called with instanceId, the hook returns state for that specific recording instance only.
error
boolean
true if this instance has a recording error.
errorMsg
string
Error message for this instance, if any.
instanceId
string
The instance ID.
isLocalParticipantRecorded
boolean
Whether the local participant is recorded by this instance.
isRecording
boolean
Whether this instance is currently recording.
layout
Object
The recording layout for this instance.
local
boolean
true if this is a local recording.
recordingId
string
The recording ID for this instance.
recordingStartedDate
Date
When this instance started recording.
startedBy
string
Who started this recording instance.
startRecording
Function
See daily-js startRecording().
stopRecording
Function
See daily-js stopRecording().
type
string
The recording type for this instance.
updateRecording
Function
See daily-js updateRecording().

Example

Basic usage

import { useRecording } from '@daily-co/daily-react';

export const UseRecordingDemo = () => {
  const recording = useRecording();

  return <div>{!recording.isRecording ? 'Not' : ''} recording</div>;
};

Multi-instance usage

import { useRecording } from '@daily-co/daily-react';
import { useRecordingInstances } from '@daily-co/daily-react';

// instanceId must be a valid UUID
const PORTRAIT_INSTANCE = 'a1b2c3d4-5678-9abc-def0-1234567890ab';
const LANDSCAPE_INSTANCE = 'b2c3d4e5-6789-abcd-ef01-234567890abc';

export const MultiRecordingDemo = () => {
  // Aggregate state: true if any instance is recording
  const { isRecording } = useRecording();

  // Per-instance state
  const portraitRecording = useRecording({
    instanceId: PORTRAIT_INSTANCE,
  });
  const landscapeRecording = useRecording({
    instanceId: LANDSCAPE_INSTANCE,
  });

  return (
    <div>
      <p>Any recording active: {isRecording ? 'Yes' : 'No'}</p>
      <p>Portrait: {portraitRecording.isRecording ? 'Recording' : 'Idle'}</p>
      <p>Landscape: {landscapeRecording.isRecording ? 'Recording' : 'Idle'}</p>
    </div>
  );
};

See also