Control the active call session programmatically using the static methods on CometChatCalls. These methods allow you to manage audio, video, and other call features.
Audio Controls
Mute Audio
Mute the local user’s microphone:
Unmute Audio
Unmute the local user’s microphone:
Video Controls
Pause Video
Stop sending the local user’s video:
Resume Video
Resume sending the local user’s video:
Switch Camera
Toggle between front and rear cameras:
Session Control
Leave Session
End the call and leave the session:
The leaveSession() method ends the call for the local user. Other participants will remain in the call unless they also leave.
Raise Hand
Raise Hand
Signal to other participants that you want attention:
Lower Hand
Lower your raised hand:
Layout Control
Set Layout
Change the call layout programmatically:
| Layout | Description |
|---|
TILE | Grid layout showing all participants equally |
SIDEBAR | Main video with participants in a sidebar |
SPOTLIGHT | Focus on one participant with others minimized |
Picture-in-Picture
Enable Picture-in-Picture
Enable PiP mode to continue the call in a floating window:
Disable Picture-in-Picture
Exit PiP mode and return to full-screen:
Participant Management
Pin Participant
Pin a participant to the main view:
| Parameter | Type | Description |
|---|
participantId | string | The participant’s ID |
type | string | 'human' for user video, 'screen-share' for screen share |
Unpin Participant
Remove the pinned participant:
Mute Participant
Mute another participant’s audio (requires moderator permissions):
Pause Participant Video
Pause another participant’s video (requires moderator permissions):
Chat Integration
Update the unread message count on the chat button:
Complete Example
Legacy Methods
These methods are deprecated but still available for backward compatibility:
| Deprecated Method | Replacement |
|---|
endSession() | leaveSession() |