Skip to main content
Handle call session events to build responsive UIs. The SDK provides event listeners to monitor session status, participant activities, media changes, button clicks, and layout changes.

Adding Event Listeners

Use the addEventListener() method to register event listeners. The method returns an unsubscribe function that you should call to remove the listener when no longer needed.
Listeners are global: they are not tied to a session, work before any session exists, and stay registered across sessions until you call the function they return. The session object has the same method, session.addEventListener(eventName, listener), with the same behavior. To ask whether there is a session right now, use CometChatCalls.getActiveSession():
getActiveSession() returns the session as soon as it starts preparing, before anyone joins: from the moment CometChatCalls.initiateCall has created the call on the caller, and from the moment CometChatCalls.connect is called on a ringing callee. It returns null again once the session ends, its prepare fails or is cancelled, or a prepared session expires after 5 minutes. While a session is only prepared, the SDK reports onConnected, onConnectionFailed (fatal errors only), onConnectionClosed and the roster events (onParticipantConnected, onParticipantJoined, onParticipantLeft, onParticipantListChanged); that is what lets a caller see “ringing” and “answered” without joining (see Ringing).

Session Events

Monitor the call session lifecycle including join/leave events and connection status.

Connected

Fired when a prepared session has connected: signalling only, no camera or microphone, and other participants do not see you yet. It fires once per prepare (initiateCall on the caller, connect on the callee); the actual join is onSessionJoined.

Session Joined

Fired when you successfully connect to the session.

Session Left

Fired when you leave the session.

Session Timed Out

Fired when the session ends due to inactivity timeout. It is not used on a prepared session: one that nobody joins within 5 minutes reports onConnectionClosed instead.

Connection Lost

Fired when the network connection is interrupted.

Connection Restored

Fired when the connection is restored after being lost.

Connection Closed

Fired when the connection is permanently closed. On a session that was only prepared (an outgoing call still ringing, or an incoming call this tab prepared), it means the call ended before anyone joined: declined, cancelled (in a 1:1 call), the room went away, leave() or endCall tore it down, or nobody joined within 5 minutes. The event carries no reason.

Participant Events

Monitor participant activities including join/leave, audio/video state, hand raise, screen sharing, and recording.

Participant Connected

Fired when a remote participant’s device has prepared the session without joining it. On the caller’s prepared session, this is the callee’s device ringing.

Participant Joined

Fired when a participant joins the call. On the caller’s prepared session, this is the callee answering: join with session.join(container) now.

Participant Left

Fired when a participant leaves the call.

Participant List Changed

Fired when the participant list is updated.

Participant Audio Muted

Fired when a participant mutes their microphone.

Participant Audio Unmuted

Fired when a participant unmutes their microphone.

Participant Video Paused

Fired when a participant turns off their camera.

Participant Video Resumed

Fired when a participant turns on their camera.

Participant Hand Raised

Fired when a participant raises their hand.

Participant Hand Lowered

Fired when a participant lowers their hand.

Participant Started Screen Share

Fired when a participant starts screen sharing.

Participant Stopped Screen Share

Fired when a participant stops screen sharing.

Participant Started Recording

Fired when a participant starts recording.

Participant Stopped Recording

Fired when a participant stops recording.

Dominant Speaker Changed

Fired when the active speaker changes.

Media Events

Monitor your local media state changes including audio/video status, recording, and device changes.

Audio Muted

Fired when your microphone is muted.

Audio Unmuted

Fired when your microphone is unmuted.

Video Paused

Fired when your camera is turned off.

Video Resumed

Fired when your camera is turned on.

Recording Started

Fired when call recording starts.

Recording Stopped

Fired when call recording stops.

Screen Share Started

Fired when you start screen sharing.

Screen Share Stopped

Fired when you stop screen sharing.

Audio Input Device Changed

Fired when the audio input device changes.

Audio Output Device Changed

Fired when the audio output device changes.

Video Input Device Changed

Fired when the video input device changes.

Audio Input Devices Changed

Fired when the list of available audio input devices changes.

Audio Output Devices Changed

Fired when the list of available audio output devices changes.

Video Input Devices Changed

Fired when the list of available video input devices changes.

Button Click Events

Intercept UI button clicks from the default call interface to add custom behavior or analytics.

Leave Session Button Clicked

Fired when the leave button is clicked. The SDK leaves the session itself right after, so only clean up here.

Toggle Audio Button Clicked

Fired when the mute/unmute button is clicked.

Toggle Video Button Clicked

Fired when the video on/off button is clicked.

Raise Hand Button Clicked

Fired when the raise hand button is clicked.

Share Invite Button Clicked

Fired when the share/invite button is clicked.

Change Layout Button Clicked

Fired when the layout change button is clicked.

Participant List Button Clicked

Fired when the participant list button is clicked.

Chat Button Clicked

Fired when the in-call chat button is clicked.

Recording Toggle Button Clicked

Fired when the recording toggle button is clicked.

Screen Share Button Clicked

Fired when the screen share button is clicked.

Layout Events

Monitor layout changes including layout type switches and participant list visibility.

Call Layout Changed

Fired when the call layout changes.

Participant List Visible

Fired when the participant list panel is opened.

Participant List Hidden

Fired when the participant list panel is closed.

Participant Object Reference