Skip to main content
Manage other participants during an active call session. These methods allow you to mute participants, pause their video, and pin/unpin them in the call layout.

Prerequisites

  • An active call session
  • Access to the CallSession instance
  • Appropriate permissions (typically host/moderator privileges)

Get CallSession Instance

Participant action methods are called on the CallSession singleton:
CallSession? callSession = CallSession.getInstance();
CallSession.getInstance() returns null if no active session exists. Always use the null-aware ?. operator when calling methods.

Mute Participant

Mute a specific participant’s audio. This prevents other participants from hearing them.
String participantId = "participant_uid";
await CallSession.getInstance()?.muteParticipant(participantId);
ParameterTypeDescription
participantIdStringThe unique identifier of the participant to mute
When a participant is muted, all participants receive the onParticipantAudioMuted(Participant) callback on their ParticipantEventListener.

Pause Participant Video

Pause a specific participant’s video feed. Other participants will see a placeholder instead of their video.
String participantId = "participant_uid";
await CallSession.getInstance()?.pauseParticipantVideo(participantId);
ParameterTypeDescription
participantIdStringThe unique identifier of the participant whose video to pause
When a participant’s video is paused, all participants receive the onParticipantVideoPaused(Participant) callback on their ParticipantEventListener.

Pin Participant

Pin a participant to keep them prominently displayed in the call layout, regardless of who is speaking.
await CallSession.getInstance()?.pinParticipant(participant.uid);
Pinning is particularly useful in Spotlight layout mode where you want to keep a specific participant in focus.

Unpin Participant

Remove the pin from a participant, returning to the default layout behavior.
await CallSession.getInstance()?.unPinParticipant();

Listen for Participant Events

Register a ParticipantEventListener to receive callbacks when participant states change:
CallSession.getInstance()?.addParticipantEventListener(ParticipantEventListeners(
  onParticipantJoined: (Participant participant) {
    debugPrint("${participant.name} joined the call");
  },
  onParticipantLeft: (Participant participant) {
    debugPrint("${participant.name} left the call");
  },
  onParticipantAudioMuted: (Participant participant) {
    debugPrint("${participant.name} was muted");
  },
  onParticipantAudioUnmuted: (Participant participant) {
    debugPrint("${participant.name} was unmuted");
  },
  onParticipantVideoPaused: (Participant participant) {
    debugPrint("${participant.name}'s video was paused");
  },
  onParticipantVideoResumed: (Participant participant) {
    debugPrint("${participant.name}'s video was resumed");
  },
  onParticipantListChanged: (List<Participant> participants) {
    debugPrint("Participant list updated: ${participants.length} participants");
    // Update your participant list UI
  },
  onDominantSpeakerChanged: (Participant participant) {
    debugPrint("Dominant speaker: ${participant.name}");
  },
));
Flutter listeners are not lifecycle-aware. You must manually remove listeners in your widget’s dispose() method to prevent memory leaks.

Participant Object

The Participant object contains information about a call participant:
PropertyTypeDescription
uidStringUnique identifier of the participant
nameStringDisplay name of the participant
avatarStringURL of the participant’s avatar image
audioMutedboolWhether the participant’s audio is muted
videoPausedboolWhether the participant’s video is paused
isPinnedboolWhether the participant is pinned in the layout

Show/Hide Participant List Button

Control the visibility of the participant list button in the call UI:
SessionSettings sessionSettings = CometChatCalls.SessionSettingsBuilder()
    .hideParticipantListButton(false)  // Show the participant list button
    .build();

Participant List Button Click Listener

Listen for when users tap the participant list button:
CallSession.getInstance()?.addButtonClickListener(ButtonClickListeners(
  onParticipantListButtonClicked: () {
    debugPrint("Participant list button clicked");
    // Show custom participant list UI if needed
  },
));

Next Steps

Layout & UI

Control call layout and UI elements

Participant Event Listener

Handle all participant events