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:
val callSession = CallSession.getInstance()

Mute Participant

Mute a specific participant’s audio. This prevents other participants from hearing them.
val participantId = "participant_uid"
callSession.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.
val participantId = "participant_uid"
callSession.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.
callSession.pinParticipant()
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.
callSession.unPinParticipant()

Listen for Participant Events

Register a ParticipantEventListener to receive callbacks when participant states change:
callSession.addParticipantEventListener(this, object : ParticipantEventListener {
    override fun onParticipantJoined(participant: Participant) {
        Log.d(TAG, "${participant.name} joined the call")
    }

    override fun onParticipantLeft(participant: Participant) {
        Log.d(TAG, "${participant.name} left the call")
    }

    override fun onParticipantAudioMuted(participant: Participant) {
        Log.d(TAG, "${participant.name} was muted")
    }

    override fun onParticipantAudioUnmuted(participant: Participant) {
        Log.d(TAG, "${participant.name} was unmuted")
    }

    override fun onParticipantVideoPaused(participant: Participant) {
        Log.d(TAG, "${participant.name}'s video was paused")
    }

    override fun onParticipantVideoResumed(participant: Participant) {
        Log.d(TAG, "${participant.name}'s video was resumed")
    }

    override fun onParticipantListChanged(participants: List<Participant>) {
        Log.d(TAG, "Participant list updated: ${participants.size} participants")
        // Update your participant list UI
    }

    override fun onDominantSpeakerChanged(participant: Participant) {
        Log.d(TAG, "Dominant speaker: ${participant.name}")
    }

    // Other callbacks...
    override fun onParticipantHandRaised(participant: Participant) {}
    override fun onParticipantHandLowered(participant: Participant) {}
    override fun onParticipantStartedScreenShare(participant: Participant) {}
    override fun onParticipantStoppedScreenShare(participant: Participant) {}
    override fun onParticipantStartedRecording(participant: Participant) {}
    override fun onParticipantStoppedRecording(participant: Participant) {}
})

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
isAudioMutedBooleanWhether the participant’s audio is muted
isVideoPausedBooleanWhether the participant’s video is paused

Show/Hide Participant List Button

Control the visibility of the participant list button in the call UI:
val 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.addButtonClickListener(this, object : ButtonClickListener {
    override fun onParticipantListButtonClicked() {
        Log.d(TAG, "Participant list button clicked")
        // Show custom participant list UI if needed
    }

    // Other ButtonClickListener callbacks...
    override fun onLeaveSessionButtonClicked() {}
    override fun onRaiseHandButtonClicked() {}
    override fun onShareInviteButtonClicked() {}
    override fun onChangeLayoutButtonClicked() {}
    override fun onToggleAudioButtonClicked() {}
    override fun onToggleVideoButtonClicked() {}
    override fun onSwitchCameraButtonClicked() {}
    override fun onChatButtonClicked() {}
    override fun onRecordingToggleButtonClicked() {}
})

Next Steps