CometChat Calls SDK v5 — Participant Management
Overview
Control other participants during calls: mute their audio, pause their video, pin/unpin in layout. Monitor participant state via ParticipantEventListener.
Key Imports
import CometChatCallsSDK
Implementation
Participant Actions
CallSession.shared.muteParticipant(participantId: participant.uid)
CallSession.shared.pauseParticipantVideo(participantId: participant.uid)
CallSession.shared.pinParticipant(participantId: participant.uid, type: "pin")
CallSession.shared.unpinParticipant()
Listen for Participant Events
class ParticipantHandler: NSObject, ParticipantEventListener {
func onParticipantJoined(participant: Participant) {}
func onParticipantLeft(participant: Participant) {}
func onParticipantListChanged(participants: [Participant]) {
// Full participant list — use for UI updates
}
func onParticipantAudioMuted(participant: Participant) {}
func onParticipantAudioUnmuted(participant: Participant) {}
func onParticipantVideoPaused(participant: Participant) {}
func onParticipantVideoResumed(participant: Participant) {}
func onParticipantHandRaised(participant: Participant) {}
func onParticipantHandLowered(participant: Participant) {}
func onDominantSpeakerChanged(participant: Participant) {}
func onParticipantStartedScreenShare(participant: Participant) {}
func onParticipantStoppedScreenShare(participant: Participant) {}
func onParticipantStartedRecording(participant: Participant) {}
func onParticipantStoppedRecording(participant: Participant) {}
}
CallSession.shared.addParticipantEventListener(handler)
Participant Properties
| Property | Type | Description |
|---|---|---|
uid |
String | CometChat user ID |
name |
String | Display name |
avatar |
String | Avatar URL |
totalAudioMinutes |
Double | Total audio minutes |
totalVideoMinutes |
Double | Total video minutes |
totalDurationInMinutes |
Double | Total duration in minutes |
deviceID |
String | Device identifier |
isJoined |
Bool | Currently joined? |
joinedAt |
Date | Join timestamp |
mid |
String | Meeting ID |
state |
String | Participant state |
leftAt |
Date | Left timestamp |
Show/Hide Participant List Button
let settings = SessionSettingsBuilder()
.hideParticipantListButton(false) // show participant list
.hideRaiseHandButton(false) // show raise hand
.build()
Gotchas
- By default, all participants have moderator access (can mute/pause others)
- Pinning only affects your local view
unpinParticipant()takes no arguments — unpins whoever is currently pinned- There is no "kick" API — only mute and pause video
Sample App Reference
CallView.swift— Session settings and listener setup