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 CallSession singleton instance during an active call session.

Get CallSession Instance

The CallSession is a singleton that manages the active call. All actions are accessed through this instance.
val callSession = CallSession.getInstance()
Always check isSessionActive() before calling actions to ensure there’s an active call.

Actions

Mute Audio

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

Unmute Audio

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

Set Audio Mode

Changes the audio output device during a call.
callSession.setAudioMode(AudioMode.SPEAKER)
callSession.setAudioMode(AudioMode.EARPIECE)
callSession.setAudioMode(AudioMode.BLUETOOTH)
callSession.setAudioMode(AudioMode.HEADPHONES)
ValueDescription
SPEAKERRoutes audio through device loudspeaker
EARPIECERoutes audio through phone earpiece
BLUETOOTHRoutes audio through connected Bluetooth device
HEADPHONESRoutes audio through wired headphones

Pause Video

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

Resume Video

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

Switch Camera

Toggles between front and back cameras without interrupting the video stream.
callSession.switchCamera()

Start Recording

Begins server-side recording of the call. All participants are notified.
callSession.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.
callSession.stopRecording()

Mute Participant

Mutes a specific participant’s audio. This is a moderator action.
callSession.muteParticipant(participant.uid)

Pause Participant Video

Pauses a specific participant’s video. This is a moderator action.
callSession.pauseParticipantVideo(participant.uid)

Pin Participant

Pins a participant to keep them prominently displayed regardless of who is speaking.
callSession.pinParticipant(participant.uid)

Unpin Participant

Removes the pin, returning to automatic speaker highlighting.
callSession.unPinParticipant()

Set Layout

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

Enable Picture In Picture Layout

Enables PiP mode, allowing the call to continue in a floating window.
callSession.enablePictureInPictureLayout()

Disable Picture In Picture Layout

Disables PiP mode, returning to full-screen call interface.
callSession.disablePictureInPictureLayout()

Set Chat Button Unread Count

Updates the badge count on the chat button. Pass 0 to hide the badge.
callSession.setChatButtonUnreadCount(5)

Is Session Active

Returns true if a call session is active, false otherwise.
val isActive = callSession.isSessionActive()

Leave Session

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

Raise Hand

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

Lower Hand

Removes the hand-raised indicator.
callSession.lowerHand()
PropertyTypeDescription
uidStringUnique identifier (CometChat user ID)
nameStringDisplay name
avatarStringURL of avatar image
pidStringParticipant ID for this call session
roleStringRole in the call
audioMutedBooleanWhether audio is muted
videoPausedBooleanWhether video is paused
isPinnedBooleanWhether pinned in layout
isPresentingBooleanWhether screen sharing
raisedHandTimestampLongTimestamp when hand was raised