> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-ios-v5-calls-corrections.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Actions

> Use CometChat Calls SDK v5 actions on iOS to control calls, manage audio/video state, share screens, and handle in-call behavior.

Use call actions to create your own custom controls or trigger call functionality dynamically based on your use case. All actions are called on the `CallSession.shared` singleton instance during an active call session.

## Get CallSession Instance

The `CallSession` is a singleton that manages the active call. All actions are accessed through this instance.

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    let callSession = CallSession.shared
    ```
  </Tab>

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

<Note>
  Always check `isCallSessionActive()` before calling actions to ensure there's an active call.
</Note>

## Actions

### Mute Audio

Mutes your local microphone, stopping audio transmission to other participants.

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

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

### Unmute Audio

Unmutes your local microphone, resuming audio transmission.

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

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

### Set Audio Mode

Changes the audio output device during a call.

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    CallSession.shared.setAudioMode("SPEAKER")
    CallSession.shared.setAudioMode("EARPIECE")
    CallSession.shared.setAudioMode("BLUETOOTH")
    CallSession.shared.setAudioMode("HEADPHONES")
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objectivec theme={null}
    [[CallSession shared] setAudioMode:@"SPEAKER"];
    [[CallSession shared] setAudioMode:@"EARPIECE"];
    [[CallSession shared] setAudioMode:@"BLUETOOTH"];
    [[CallSession shared] setAudioMode:@"HEADPHONES"];
    ```
  </Tab>
</Tabs>

<Accordion title="AudioMode Values">
  | Value        | Description                                     |
  | ------------ | ----------------------------------------------- |
  | `SPEAKER`    | Routes audio through device loudspeaker         |
  | `EARPIECE`   | Routes audio through phone earpiece             |
  | `BLUETOOTH`  | Routes audio through connected Bluetooth device |
  | `HEADPHONES` | Routes audio through wired headphones           |
</Accordion>

### Pause Video

Turns off your local camera, stopping video transmission. Other participants see your avatar.

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

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

### Resume Video

Turns on your local camera, resuming video transmission.

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

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

### Switch Camera

Toggles between front and back cameras without interrupting the video stream.

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

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

### Start Recording

Begins server-side recording of the call. All participants are notified.

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

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

<Warning>
  Recording requires the feature to be enabled for your CometChat app.
</Warning>

### Stop Recording

Stops the current recording. The recording is saved and accessible via the dashboard.

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

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

### Start Transcription

*Available since v5.0.4*

Begins server-side transcription of the call. This also enables the live closed captions overlay.

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

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

<Warning>
  Transcription requires the feature to be enabled for your CometChat app.
</Warning>

### Stop Transcription

*Available since v5.0.4*

Stops the current transcription and clears any captions currently on screen. The transcript is saved and can be retrieved with [`TranscriptsRequest`](/calls/ios/transcription#retrieving-transcripts).

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

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

### Mute Participant

Mutes a specific participant's audio. This is a moderator action.

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    guard let uid = participant.uid else { return }
    CallSession.shared.muteParticipant(participantId: uid)
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objectivec theme={null}
    if (participant.uid) {
        [[CallSession shared] muteParticipantWithParticipantId:participant.uid];
    }
    ```
  </Tab>
</Tabs>

### Pause Participant Video

Pauses a specific participant's video. This is a moderator action.

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    guard let uid = participant.uid else { return }
    CallSession.shared.pauseParticipantVideo(participantId: uid)
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objectivec theme={null}
    if (participant.uid) {
        [[CallSession shared] pauseParticipantVideoWithParticipantId:participant.uid];
    }
    ```
  </Tab>
</Tabs>

### Pin Participant

Pins a participant to keep them prominently displayed regardless of who is speaking.

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    CallSession.shared.pinParticipant(participantId: "PARTICIPANT_UID", type: "pin")
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objectivec theme={null}
    [[CallSession shared] pinParticipantWithParticipantId:@"PARTICIPANT_UID" type:@"pin"];
    ```
  </Tab>
</Tabs>

### Unpin Participant

Removes the pin, returning to automatic speaker highlighting.

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

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

### Set Layout

Changes the call layout. Each participant can choose their own layout independently.

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

  <Tab title="Objective-C">
    ```objectivec theme={null}
    [[CallSession shared] setLayout:@"TILE"];
    [[CallSession shared] setLayout:@"SPOTLIGHT"];
    [[CallSession shared] setLayout:@"SIDEBAR"];
    ```
  </Tab>
</Tabs>

<Accordion title="LayoutType Values">
  | Value       | Description                                           |
  | ----------- | ----------------------------------------------------- |
  | `TILE`      | Grid layout with equally-sized tiles                  |
  | `SPOTLIGHT` | Large view for active speaker, small tiles for others |
  | `SIDEBAR`   | Main speaker with participants in a sidebar           |
</Accordion>

### Enable Picture In Picture Layout

Enables PiP mode, allowing the call to continue in a floating window.

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

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

### Disable Picture In Picture Layout

Disables PiP mode, returning to full-screen call interface.

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

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

### Set Chat Button Unread Count

Updates the badge count on the chat button. Pass 0 to hide the badge.

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

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

### Is Session Active

Returns `true` if a call session is active, `false` otherwise.

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

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

### Leave Session

Ends your participation and disconnects gracefully. The call continues for other participants.

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

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

### Raise Hand

Shows a hand-raised indicator to get attention from other participants.

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

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

### Lower Hand

Removes the hand-raised indicator.

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

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

### Hide Settings Panel

Hides the settings panel if it's currently visible.

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

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

<Accordion title="Participant Object Reference">
  | Property                 | Type      | Description                                                     |
  | ------------------------ | --------- | --------------------------------------------------------------- |
  | `uid`                    | `String?` | CometChat user ID — the identifier every moderator action takes |
  | `name`                   | `String?` | Display name                                                    |
  | `avatar`                 | `String?` | URL of avatar image                                             |
  | `mid`                    | `String?` | Media ID for this call session                                  |
  | `state`                  | `String?` | Participant state as reported by the server                     |
  | `isJoined`               | `Bool?`   | Whether the participant is currently joined                     |
  | `joinedAt`               | `Int?`    | Join timestamp                                                  |
  | `leftAt`                 | `Int?`    | Leave timestamp                                                 |
  | `deviceID`               | `String?` | Device identifier                                               |
  | `totalAudioMinutes`      | `Double?` | Audio minutes consumed                                          |
  | `totalVideoMinutes`      | `Double?` | Video minutes consumed                                          |
  | `totalDurationInMinutes` | `Double?` | Total session minutes                                           |

  <Note>
    **Every property is Optional.** `Participant` carries no mute / video / pin / hand-raise /
    screen-share flags, and the SDK exposes no getter for them — track that state in your own app
    from the [participant events](/calls/ios/events). Because the events fire only on change, a
    client that joins late cannot recover state that was already in effect.
  </Note>
</Accordion>
