Skip to main content
Use call actions to create your own custom controls or trigger call functionality dynamically based on your use case. All actions are called on the CometChatCalls class during an active call session.

Audio Controls

Mute Audio

Mutes your local microphone, stopping audio transmission to other participants.
CometChatCalls.muteAudio();

Unmute Audio

Unmutes your local microphone, resuming audio transmission.
CometChatCalls.unMuteAudio();

Video Controls

Pause Video

Turns off your local camera, stopping video transmission. Other participants see your avatar.
CometChatCalls.pauseVideo();

Resume Video

Turns on your local camera, resuming video transmission.
CometChatCalls.resumeVideo();

Switch Camera

Toggles between front and back cameras (on supported devices).
CometChatCalls.switchCamera();

Screen Sharing

Start Screen Sharing

Begins sharing your screen with other participants. The browser will prompt the user to select which screen, window, or tab to share.
CometChatCalls.startScreenSharing();

Stop Screen Sharing

Stops the current screen share.
CometChatCalls.stopScreenSharing();

Recording

Start Recording

Begins server-side recording of the call. All participants are notified.
CometChatCalls.startRecording();
Recording requires the feature to be enabled for your CometChat app.

Stop Recording

Stops the current recording. The recording is saved and accessible via the dashboard.
CometChatCalls.stopRecording();

Participant Management

Mute Participant

Mutes a specific participant’s audio. This is a moderator action.
CometChatCalls.muteParticipant(participantId);
ParameterTypeDescription
participantIdStringThe participant’s unique identifier

Pause Participant Video

Pauses a specific participant’s video. This is a moderator action.
CometChatCalls.pauseParticipantVideo(participantId);
ParameterTypeDescription
participantIdStringThe participant’s unique identifier

Pin Participant

Pins a participant to keep them prominently displayed regardless of who is speaking.
CometChatCalls.pinParticipant(participantId, type);
ParameterTypeDescription
participantIdStringThe participant’s unique identifier
typeStringThe participant type

Unpin Participant

Removes the pin, returning to automatic speaker highlighting.
CometChatCalls.unpinParticipant();

Layout

Set Layout

Changes the call layout. Each participant can choose their own layout independently.
CometChatCalls.setLayout("TILE");
CometChatCalls.setLayout("SIDEBAR");
CometChatCalls.setLayout("SPOTLIGHT");
ValueDescription
TILEGrid layout with equally-sized tiles
SIDEBARMain speaker with participants in a sidebar
SPOTLIGHTLarge view for active speaker, small tiles for others

Raise Hand

Raise Hand

Shows a hand-raised indicator to get attention from other participants.
CometChatCalls.raiseHand();

Lower Hand

Removes the hand-raised indicator.
CometChatCalls.lowerHand();

Session Control

Leave Session

Ends your participation and disconnects gracefully. The call continues for other participants.
CometChatCalls.leaveSession();

UI Controls

Show Settings Dialog

Opens the settings dialog for audio/video device selection.
CometChatCalls.showSettingsDialog();

Hide Settings Dialog

Closes the settings dialog.
CometChatCalls.hideSettingsDialog();

Show Virtual Background Dialog

Opens the virtual background settings dialog.
CometChatCalls.showVirtualBackgroundDialog();

Hide Virtual Background Dialog

Closes the virtual background dialog.
CometChatCalls.hideVirtualBackgroundDialog();

Set Chat Button Unread Count

Updates the badge count on the chat button. Pass 0 to hide the badge.
CometChatCalls.setChatButtonUnreadCount(5);
ParameterTypeDescription
countNumberThe unread message count to display

Virtual Background

Clear Virtual Background

Removes any applied virtual background.
CometChatCalls.clearVirtualBackground();

Set Virtual Background Blur Level

Applies a blur effect to the background with the specified intensity.
CometChatCalls.setVirtualBackgroundBlurLevel(10);
ParameterTypeDescription
blurLevelNumberThe blur intensity level

Set Virtual Background Image

Sets a custom image as the virtual background.
CometChatCalls.setVirtualBackgroundImage("https://example.com/background.jpg");
ParameterTypeDescription
imageUrlStringURL of the background image

Device Management

Get Audio Input Devices

Returns a list of available audio input devices (microphones).
const audioInputDevices = CometChatCalls.getAudioInputDevices();
console.log(audioInputDevices);

Get Audio Output Devices

Returns a list of available audio output devices (speakers).
const audioOutputDevices = CometChatCalls.getAudioOutputDevices();
console.log(audioOutputDevices);

Get Video Input Devices

Returns a list of available video input devices (cameras).
const videoInputDevices = CometChatCalls.getVideoInputDevices();
console.log(videoInputDevices);

Get Current Audio Input Device

Returns the currently selected audio input device.
const currentAudioInput = CometChatCalls.getCurrentAudioInputDevice();
console.log(currentAudioInput);

Get Current Audio Output Device

Returns the currently selected audio output device.
const currentAudioOutput = CometChatCalls.getCurrentAudioOutputDevice();
console.log(currentAudioOutput);

Get Current Video Input Device

Returns the currently selected video input device.
const currentVideoInput = CometChatCalls.getCurrentVideoInputDevice();
console.log(currentVideoInput);

Set Audio Input Device

Sets the audio input device by device ID.
CometChatCalls.setAudioInputDevice(deviceId);

Set Audio Output Device

Sets the audio output device by device ID.
CometChatCalls.setAudioOutputDevice(deviceId);

Set Video Input Device

Sets the video input device by device ID.
CometChatCalls.setVideoInputDevice(deviceId);

Picture-in-Picture

Enable Picture-in-Picture Layout

Enables Picture-in-Picture mode for the call.
CometChatCalls.enablePictureInPictureLayout();

Disable Picture-in-Picture Layout

Disables Picture-in-Picture mode.
CometChatCalls.disablePictureInPictureLayout();