> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Recording

> CometChat Calling SDK v5 - Recording for Flutter

Record call sessions for later playback. Recordings are stored server-side and can be accessed through call logs or the CometChat Dashboard.

<Warning>
  Recording must be enabled for your CometChat app. Contact support or check your Dashboard settings if recording is not available.
</Warning>

## Start Recording

Start recording during an active call session:

```dart theme={null}
await CallSession.getInstance()?.startRecording();
```

All participants are notified when recording starts.

## Stop Recording

Stop an active recording:

```dart theme={null}
await CallSession.getInstance()?.stopRecording();
```

## Auto-Start Recording

Configure calls to automatically start recording when the session begins:

```dart theme={null}
SessionSettings sessionSettings = CometChatCalls.SessionSettingsBuilder()
    .enableAutoStartRecording(true)
    .build();
```

## Hide Recording Button

Hide the recording button from the default call UI:

```dart theme={null}
SessionSettings sessionSettings = CometChatCalls.SessionSettingsBuilder()
    .hideRecordingButton(true)
    .build();
```

## Listen for Recording Events

Monitor recording state changes using `MediaEventsListener`:

```dart theme={null}
CallSession? callSession = CallSession.getInstance();

callSession?.addMediaEventsListener(MediaEventsListener(
  onRecordingStarted: () {
    debugPrint("Recording started");
    showRecordingIndicator();
  },
  onRecordingStopped: () {
    debugPrint("Recording stopped");
    hideRecordingIndicator();
  },
  // Other callbacks...
  onAudioMuted: () {},
  onAudioUnMuted: () {},
  onVideoPaused: () {},
  onVideoResumed: () {},
  onScreenShareStarted: () {},
  onScreenShareStopped: () {},
  onAudioModeChanged: (AudioMode audioMode) {},
  onCameraFacingChanged: (CameraFacing facing) {},
));
```

## Track Participant Recording

Monitor when other participants start or stop recording using `ParticipantEventListener`:

```dart theme={null}
CallSession? callSession = CallSession.getInstance();

callSession?.addParticipantEventListener(ParticipantEventListener(
  onParticipantStartedRecording: (Participant participant) {
    debugPrint("${participant.name} started recording");
  },
  onParticipantStoppedRecording: (Participant participant) {
    debugPrint("${participant.name} stopped recording");
  },
  // Other callbacks...
));
```

## Access Recordings

Recordings are available after the call ends. You can access them in two ways:

1. **CometChat Dashboard**: Navigate to **Calls > Call Logs** in your [CometChat Dashboard](https://app.cometchat.com) to view and download recordings.

2. **Programmatically**: Fetch recordings through [Call Logs](/calls/flutter/call-logs):

```dart theme={null}
CallLogRequest callLogRequest = CallLogRequest.CallLogRequestBuilder()
    .setHasRecording(true)
    .build();

callLogRequest.fetchNext(
  onSuccess: (List<CallLog> callLogs) {
    for (CallLog callLog in callLogs) {
      callLog.recordings?.forEach((recording) {
        debugPrint("Recording URL: ${recording.recordingURL}");
        debugPrint("Duration: ${recording.duration} seconds");
        debugPrint("Start Time: ${recording.startTime}");
        debugPrint("End Time: ${recording.endTime}");
      });
    }
  },
  onError: (CometChatCallsException e) {
    debugPrint("Error: ${e.message}");
  },
);
```

## Recording Object

| Property       | Type   | Description                          |
| -------------- | ------ | ------------------------------------ |
| `rid`          | String | Unique recording identifier          |
| `recordingURL` | String | URL to download/stream the recording |
| `startTime`    | int    | Timestamp when recording started     |
| `endTime`      | int    | Timestamp when recording ended       |
| `duration`     | double | Recording duration in seconds        |
