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

# Participant Management

> CometChat Calling SDK v5 - Participant Management for Flutter

Manage participants during a call with actions like muting, pausing video, and pinning. These features help maintain order in group calls and highlight important speakers.

<Note>
  By default, all participants who join a call have moderator access and can perform these actions. Implementing role-based moderation (e.g., restricting actions to hosts only) is the responsibility of the app developer based on their use case.
</Note>

## Mute a Participant

Mute a specific participant's audio. This affects the participant for all users in the call.

```dart theme={null}
await CallSession.getInstance()?.muteParticipant(participant.uid);
```

## Pause Participant Video

Pause a specific participant's video. This affects the participant for all users in the call.

```dart theme={null}
await CallSession.getInstance()?.pauseParticipantVideo(participant.uid);
```

## Pin a Participant

Pin a participant to keep them prominently displayed regardless of who is speaking. Useful for keeping focus on a presenter or important speaker.

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

// Pin a participant
await callSession?.pinParticipant(participant.uid);

// Unpin (returns to automatic speaker highlighting)
await callSession?.unPinParticipant();
```

<Note>
  Pinning a participant only affects your local view. Other participants can pin different users independently.
</Note>

## Listen for Participant Events

Monitor participant state changes using `ParticipantEventListener`:

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

callSession?.addParticipantEventListener(ParticipantEventListener(
  onParticipantJoined: (Participant participant) {
    debugPrint("${participant.name} joined the call");
    updateParticipantList();
  },
  onParticipantLeft: (Participant participant) {
    debugPrint("${participant.name} left the call");
    updateParticipantList();
  },
  onParticipantListChanged: (List<Participant> participants) {
    debugPrint("Participant count: ${participants.length}");
    refreshParticipantList(participants);
  },
  onParticipantAudioMuted: (Participant participant) {
    debugPrint("${participant.name} was muted");
    updateMuteIndicator(participant, muted: true);
  },
  onParticipantAudioUnmuted: (Participant participant) {
    debugPrint("${participant.name} was unmuted");
    updateMuteIndicator(participant, muted: false);
  },
  onParticipantVideoPaused: (Participant participant) {
    debugPrint("${participant.name} video paused");
    showParticipantAvatar(participant);
  },
  onParticipantVideoResumed: (Participant participant) {
    debugPrint("${participant.name} video resumed");
    showParticipantVideo(participant);
  },
  onDominantSpeakerChanged: (Participant participant) {
    debugPrint("${participant.name} is now speaking");
    highlightActiveSpeaker(participant);
  },
  // Other callbacks...
  onParticipantHandRaised: (Participant participant) {},
  onParticipantHandLowered: (Participant participant) {},
  onParticipantStartedScreenShare: (Participant participant) {},
  onParticipantStoppedScreenShare: (Participant participant) {},
  onParticipantStartedRecording: (Participant participant) {},
  onParticipantStoppedRecording: (Participant participant) {},
));
```

<Note>
  Flutter listeners are not lifecycle-aware. You must manually remove listeners in your widget's `dispose()` method to prevent memory leaks.
</Note>

## Participant Object

The `Participant` object contains information about each call participant:

| Property              | Type   | Description                                      |
| --------------------- | ------ | ------------------------------------------------ |
| `uid`                 | String | Unique identifier (CometChat user ID)            |
| `name`                | String | Display name                                     |
| `avatar`              | String | URL of avatar image                              |
| `pid`                 | String | Participant ID for this call session             |
| `role`                | String | Role in the call                                 |
| `audioMuted`          | bool   | Whether audio is muted                           |
| `videoPaused`         | bool   | Whether video is paused                          |
| `isPinned`            | bool   | Whether pinned in layout                         |
| `isPresenting`        | bool   | Whether screen sharing                           |
| `raisedHandTimestamp` | int    | Timestamp when hand was raised (0 if not raised) |

## Hide Participant List Button

To hide the participant list button in the call UI:

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

<CardGroup cols={2}>
  <Card title="Participant Actions" icon="user-gear" href="/calls/flutter/participant-actions">
    Mute, pause video, and pin participants programmatically
  </Card>

  <Card title="Participant Event Listener" icon="bell" href="/calls/flutter/participant-event-listener">
    Handle all participant events
  </Card>
</CardGroup>
