Skip to main content
Handle call session events to build responsive UIs. The SDK provides five event listener interfaces to monitor session status, participant activities, media changes, button clicks, and layout changes. Each listener is lifecycle-aware and automatically cleaned up when the Activity or Fragment is destroyed.

Get CallSession Instance

The CallSession is a singleton that manages the active call. All event listener registrations and session control methods are accessed through this instance.
val callSession = CallSession.getInstance()
All event listeners are lifecycle-aware and automatically removed when the LifecycleOwner (Activity/Fragment) is destroyed. You don’t need to manually remove listeners.

Session Events

Monitor the call session lifecycle including join/leave events and connection status.
callSession.addSessionStatusListener(this, object : SessionStatusListener() {
    override fun onSessionJoined() {
        // Successfully connected to the session
    }

    override fun onSessionLeft() {
        finish() // Navigate away
    }

    override fun onSessionTimedOut() {
        // Session ended due to inactivity
        finish()
    }

    override fun onConnectionLost() {
        // Network interrupted, attempting reconnection
    }

    override fun onConnectionRestored() {
        // Connection restored after being lost
    }

    override fun onConnectionClosed() {
        // Connection permanently closed
        finish()
    }
})
EventDescription
onSessionJoined()Successfully connected and joined the session
onSessionLeft()Left the session via leaveSession() or was removed
onSessionTimedOut()Session ended due to inactivity timeout
onConnectionLost()Network interrupted, SDK attempting reconnection
onConnectionRestored()Connection restored after being lost
onConnectionClosed()Connection permanently closed, cannot reconnect

Participant Events

Monitor participant activities including join/leave, audio/video state, hand raise, screen sharing, and recording.
callSession.addParticipantEventListener(this, object : ParticipantEventListener() {
    override fun onParticipantJoined(participant: Participant) {
        // A participant joined the call
    }

    override fun onParticipantLeft(participant: Participant) {
        // A participant left the call
    }

    override fun onParticipantListChanged(participants: List<Participant>) {
        // Participant list updated
    }

    override fun onParticipantAudioMuted(participant: Participant) {}
    override fun onParticipantAudioUnmuted(participant: Participant) {}
    override fun onParticipantVideoPaused(participant: Participant) {}
    override fun onParticipantVideoResumed(participant: Participant) {}
    override fun onParticipantHandRaised(participant: Participant) {}
    override fun onParticipantHandLowered(participant: Participant) {}
    override fun onParticipantStartedScreenShare(participant: Participant) {}
    override fun onParticipantStoppedScreenShare(participant: Participant) {}
    override fun onParticipantStartedRecording(participant: Participant) {}
    override fun onParticipantStoppedRecording(participant: Participant) {}
    override fun onDominantSpeakerChanged(participant: Participant) {}
})
EventParameterDescription
onParticipantJoinedParticipantA participant connected to the call
onParticipantLeftParticipantA participant disconnected from the call
onParticipantListChangedList<Participant>Participant list updated
onParticipantAudioMutedParticipantA participant muted their microphone
onParticipantAudioUnmutedParticipantA participant unmuted their microphone
onParticipantVideoPausedParticipantA participant turned off their camera
onParticipantVideoResumedParticipantA participant turned on their camera
onParticipantHandRaisedParticipantA participant raised their hand
onParticipantHandLoweredParticipantA participant lowered their hand
onParticipantStartedScreenShareParticipantA participant started screen sharing
onParticipantStoppedScreenShareParticipantA participant stopped screen sharing
onParticipantStartedRecordingParticipantA participant started recording
onParticipantStoppedRecordingParticipantA participant stopped recording
onDominantSpeakerChangedParticipantThe active speaker changed

Media Events

Monitor your local media state changes including audio/video status, recording, and device changes.
callSession.addMediaEventsListener(this, object : MediaEventsListener() {
    override fun onAudioMuted() {
        // Your microphone was muted
    }

    override fun onAudioUnMuted() {
        // Your microphone was unmuted
    }

    override fun onVideoPaused() {
        // Your camera was turned off
    }

    override fun onVideoResumed() {
        // Your camera was turned on
    }

    override fun onRecordingStarted() {
        // Call recording started
    }

    override fun onRecordingStopped() {
        // Call recording stopped
    }

    override fun onScreenShareStarted() {}
    override fun onScreenShareStopped() {}

    override fun onAudioModeChanged(audioMode: AudioMode) {
        // Audio output device changed
    }

    override fun onCameraFacingChanged(facing: CameraFacing) {
        // Camera switched between front and back
    }
})
EventParameterDescription
onAudioMuted-Your microphone was muted
onAudioUnMuted-Your microphone was unmuted
onVideoPaused-Your camera was turned off
onVideoResumed-Your camera was turned on
onRecordingStarted-Call recording started
onRecordingStopped-Call recording stopped
onScreenShareStarted-You started screen sharing
onScreenShareStopped-You stopped screen sharing
onAudioModeChangedAudioModeAudio output device changed
onCameraFacingChangedCameraFacingCamera switched between front and back
ValueDescription
AudioMode.SPEAKERAudio routed through device loudspeaker
AudioMode.EARPIECEAudio routed through phone earpiece
AudioMode.BLUETOOTHAudio routed through connected Bluetooth device
AudioMode.HEADPHONESAudio routed through wired headphones
ValueDescription
CameraFacing.FRONTFront-facing (selfie) camera is active
CameraFacing.BACKRear-facing (main) camera is active

Button Click Events

Intercept UI button clicks from the default call interface to add custom behavior or analytics.
callSession.addButtonClickListener(this, object : ButtonClickListener() {
    override fun onLeaveSessionButtonClicked() {
        // Leave button tapped
    }

    override fun onToggleAudioButtonClicked() {
        // Mute/unmute button tapped
    }

    override fun onToggleVideoButtonClicked() {
        // Video on/off button tapped
    }

    override fun onSwitchCameraButtonClicked() {}
    override fun onRaiseHandButtonClicked() {}
    override fun onShareInviteButtonClicked() {}
    override fun onChangeLayoutButtonClicked() {}
    override fun onParticipantListButtonClicked() {}
    override fun onChatButtonClicked() {}
    override fun onRecordingToggleButtonClicked() {}
})
EventDescription
onLeaveSessionButtonClickedLeave/end call button was tapped
onToggleAudioButtonClickedMute/unmute button was tapped
onToggleVideoButtonClickedVideo on/off button was tapped
onSwitchCameraButtonClickedCamera switch button was tapped
onRaiseHandButtonClickedRaise hand button was tapped
onShareInviteButtonClickedShare/invite button was tapped
onChangeLayoutButtonClickedLayout change button was tapped
onParticipantListButtonClickedParticipant list button was tapped
onChatButtonClickedIn-call chat button was tapped
onRecordingToggleButtonClickedRecording toggle button was tapped
Button click events fire before the SDK’s default action executes. Use these to add custom logic alongside default behavior.

Layout Events

Monitor layout changes including layout type switches and Picture-in-Picture mode transitions.
callSession.addLayoutListener(this, object : LayoutListener() {
    override fun onCallLayoutChanged(layoutType: LayoutType) {
        // Layout changed (TILE, SPOTLIGHT)
    }

    override fun onParticipantListVisible() {
        // Participant list panel opened
    }

    override fun onParticipantListHidden() {
        // Participant list panel closed
    }

    override fun onPictureInPictureLayoutEnabled() {
        // Entered PiP mode
    }

    override fun onPictureInPictureLayoutDisabled() {
        // Exited PiP mode
    }
})
EventParameterDescription
onCallLayoutChangedLayoutTypeCall layout changed
onParticipantListVisible-Participant list panel was opened
onParticipantListHidden-Participant list panel was closed
onPictureInPictureLayoutEnabled-Call entered Picture-in-Picture mode
onPictureInPictureLayoutDisabled-Call exited Picture-in-Picture mode
ValueDescriptionBest For
LayoutType.TILEGrid layout with equally-sized tilesGroup discussions, team meetings
LayoutType.SPOTLIGHTLarge view for active speaker, small tiles for othersPresentations, one-on-one calls