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.
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.
Mute a Participant
Mute a specific participant’s audio. This affects the participant for all users in the call.
val callSession = CallSession.getInstance()
callSession.muteParticipant(participant.uid)
CallSession callSession = CallSession.getInstance();
callSession.muteParticipant(participant.getUid());
Pause Participant Video
Pause a specific participant’s video. This affects the participant for all users in the call.
val callSession = CallSession.getInstance()
callSession.pauseParticipantVideo(participant.uid)
CallSession callSession = CallSession.getInstance();
callSession.pauseParticipantVideo(participant.getUid());
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.
val callSession = CallSession.getInstance()
// Pin a participant
callSession.pinParticipant(participant.uid)
// Unpin (returns to automatic speaker highlighting)
callSession.unPinParticipant()
CallSession callSession = CallSession.getInstance();
// Pin a participant
callSession.pinParticipant(participant.getUid());
// Unpin (returns to automatic speaker highlighting)
callSession.unPinParticipant();
Pinning a participant only affects your local view. Other participants can pin different users independently.
Listen for Participant Events
Monitor participant state changes using ParticipantEventListener:
val callSession = CallSession.getInstance()
callSession.addParticipantEventListener(this, object : ParticipantEventListener() {
override fun onParticipantJoined(participant: Participant) {
Log.d(TAG, "${participant.name} joined the call")
updateParticipantList()
}
override fun onParticipantLeft(participant: Participant) {
Log.d(TAG, "${participant.name} left the call")
updateParticipantList()
}
override fun onParticipantListChanged(participants: List<Participant>) {
Log.d(TAG, "Participant count: ${participants.size}")
refreshParticipantList(participants)
}
override fun onParticipantAudioMuted(participant: Participant) {
Log.d(TAG, "${participant.name} was muted")
updateMuteIndicator(participant, muted = true)
}
override fun onParticipantAudioUnmuted(participant: Participant) {
Log.d(TAG, "${participant.name} was unmuted")
updateMuteIndicator(participant, muted = false)
}
override fun onParticipantVideoPaused(participant: Participant) {
Log.d(TAG, "${participant.name} video paused")
showParticipantAvatar(participant)
}
override fun onParticipantVideoResumed(participant: Participant) {
Log.d(TAG, "${participant.name} video resumed")
showParticipantVideo(participant)
}
override fun onDominantSpeakerChanged(participant: Participant) {
Log.d(TAG, "${participant.name} is now speaking")
highlightActiveSpeaker(participant)
}
// 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) {}
})
CallSession callSession = CallSession.getInstance();
callSession.addParticipantEventListener(this, new ParticipantEventListener() {
@Override
public void onParticipantJoined(Participant participant) {
Log.d(TAG, participant.getName() + " joined the call");
updateParticipantList();
}
@Override
public void onParticipantLeft(Participant participant) {
Log.d(TAG, participant.getName() + " left the call");
updateParticipantList();
}
@Override
public void onParticipantListChanged(List<Participant> participants) {
Log.d(TAG, "Participant count: " + participants.size());
refreshParticipantList(participants);
}
@Override
public void onParticipantAudioMuted(Participant participant) {
Log.d(TAG, participant.getName() + " was muted");
updateMuteIndicator(participant, true);
}
@Override
public void onParticipantAudioUnmuted(Participant participant) {
Log.d(TAG, participant.getName() + " was unmuted");
updateMuteIndicator(participant, false);
}
@Override
public void onParticipantVideoPaused(Participant participant) {
Log.d(TAG, participant.getName() + " video paused");
showParticipantAvatar(participant);
}
@Override
public void onParticipantVideoResumed(Participant participant) {
Log.d(TAG, participant.getName() + " video resumed");
showParticipantVideo(participant);
}
@Override
public void onDominantSpeakerChanged(Participant participant) {
Log.d(TAG, participant.getName() + " is now speaking");
highlightActiveSpeaker(participant);
}
// Other callbacks...
});
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 | Boolean | Whether audio is muted |
videoPaused | Boolean | Whether video is paused |
isPinned | Boolean | Whether pinned in layout |
isPresenting | Boolean | Whether screen sharing |
raisedHandTimestamp | Long | Timestamp when hand was raised (0 if not raised) |
To hide the participant list button in the call UI:
val sessionSettings = CometChatCalls.SessionSettingsBuilder()
.hideParticipantListButton(true)
.build()
SessionSettings sessionSettings = new CometChatCalls.SessionSettingsBuilder()
.hideParticipantListButton(true)
.build();