> ## 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 iOS

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:

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    CallSession.shared.startRecording()
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objectivec theme={null}
    [[CallSession shared] startRecording];
    ```
  </Tab>
</Tabs>

All participants are notified when recording starts.

## Stop Recording

Stop an active recording:

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    CallSession.shared.stopRecording()
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objectivec theme={null}
    [[CallSession shared] stopRecording];
    ```
  </Tab>
</Tabs>

## Auto-Start Recording

Configure calls to automatically start recording when the session begins:

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    let sessionSettings = CometChatCalls.sessionSettingsBuilder
        .enableAutoStartRecording(true)
        .build()
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objectivec theme={null}
    SessionSettings *sessionSettings = [[[CometChatCalls sessionSettingsBuilder]
        enableAutoStartRecording:YES]
        build];
    ```
  </Tab>
</Tabs>

## Hide Recording Button

Hide the recording button from the default call UI:

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    let sessionSettings = CometChatCalls.sessionSettingsBuilder
        .hideRecordingButton(true)
        .build()
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objectivec theme={null}
    SessionSettings *sessionSettings = [[[CometChatCalls sessionSettingsBuilder]
        hideRecordingButton:YES]
        build];
    ```
  </Tab>
</Tabs>

## Listen for Recording Events

Monitor recording state changes using `MediaEventsListener`:

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    class CallViewController: UIViewController, MediaEventsListener {
        
        override func viewDidLoad() {
            super.viewDidLoad()
            CallSession.shared.addMediaEventsListener(self)
        }
        
        deinit {
            CallSession.shared.removeMediaEventsListener(self)
        }
        
        func onRecordingStarted() {
            print("Recording started")
            showRecordingIndicator()
        }

        func onRecordingStopped() {
            print("Recording stopped")
            hideRecordingIndicator()
        }

        // Other callbacks...
        func onAudioMuted() {}
        func onAudioUnMuted() {}
        func onVideoPaused() {}
        func onVideoResumed() {}
        func onScreenShareStarted() {}
        func onScreenShareStopped() {}
        func onAudioModeChanged(audioModeType: AudioModeType) {}
        func onCameraFacingChanged(cameraFacing: CameraFacing) {}
    }
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objectivec theme={null}
    @interface CallViewController () <MediaEventsListener>
    @end

    @implementation CallViewController

    - (void)viewDidLoad {
        [super viewDidLoad];
        [[CallSession shared] addMediaEventsListener:self];
    }

    - (void)dealloc {
        [[CallSession shared] removeMediaEventsListener:self];
    }

    - (void)onRecordingStarted {
        NSLog(@"Recording started");
        [self showRecordingIndicator];
    }

    - (void)onRecordingStopped {
        NSLog(@"Recording stopped");
        [self hideRecordingIndicator];
    }

    // Other callbacks...

    @end
    ```
  </Tab>
</Tabs>

## Track Participant Recording

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

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    class CallViewController: UIViewController, ParticipantEventListener {
        
        override func viewDidLoad() {
            super.viewDidLoad()
            CallSession.shared.addParticipantEventListener(self)
        }
        
        func onParticipantStartedRecording(participant: Participant) {
            print("\(participant.name ?? "") started recording")
        }

        func onParticipantStoppedRecording(participant: Participant) {
            print("\(participant.name ?? "") stopped recording")
        }

        // Other callbacks...
    }
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objectivec theme={null}
    - (void)onParticipantStartedRecordingWithParticipant:(Participant *)participant {
        NSLog(@"%@ started recording", participant.name);
    }

    - (void)onParticipantStoppedRecordingWithParticipant:(Participant *)participant {
        NSLog(@"%@ stopped recording", participant.name);
    }
    ```
  </Tab>
</Tabs>

## 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/ios/call-logs).

## 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        |
