ButtonClickListener. This listener provides callbacks when users tap buttons in the call UI, allowing you to implement custom behavior or show confirmation dialogs.
Prerequisites
- An active call session
- Access to the
CallSessioninstance
Register Listener
Register aButtonClickListener to receive button click callbacks:
- Kotlin
- Java
The listener is automatically removed when the
LifecycleOwner (Activity/Fragment) is destroyed, preventing memory leaks.Callbacks
onLeaveSessionButtonClicked
Triggered when the user taps the leave session button.- Kotlin
- Java
- Show confirmation dialog before leaving
- Log analytics event
- Perform cleanup before leaving
onToggleAudioButtonClicked
Triggered when the user taps the audio mute/unmute button.- Kotlin
- Java
- Log analytics events
- Show tooltip on first use
- Implement custom audio toggle logic
onToggleVideoButtonClicked
Triggered when the user taps the video on/off button.- Kotlin
- Java
- Log analytics events
- Check camera permissions
- Implement custom video toggle logic
onSwitchCameraButtonClicked
Triggered when the user taps the switch camera button.- Kotlin
- Java
- Log analytics events
- Show camera switching animation
- Track front/back camera usage
onRaiseHandButtonClicked
Triggered when the user taps the raise hand button.- Kotlin
- Java
- Show confirmation feedback
- Log analytics events
- Implement custom hand raise behavior
onShareInviteButtonClicked
Triggered when the user taps the share invite button.- Kotlin
- Java
- Show custom share sheet
- Generate and share invite link
- Copy link to clipboard
onChangeLayoutButtonClicked
Triggered when the user taps the change layout button.- Kotlin
- Java
- Show custom layout picker
- Log layout change analytics
- Implement custom layout switching
onParticipantListButtonClicked
Triggered when the user taps the participant list button.- Kotlin
- Java
- Log analytics events
- Show custom participant list UI
- Track feature usage
onChatButtonClicked
Triggered when the user taps the chat button.- Kotlin
- Java
- Open custom chat interface
- Show in-call messaging overlay
- Navigate to chat screen
onRecordingToggleButtonClicked
Triggered when the user taps the recording button.- Kotlin
- Java
- Show recording consent dialog
- Check recording permissions
- Log recording analytics
Complete Example
Here’s a complete example handling all button click events:- Kotlin
- Java
Callbacks Summary
Hide Buttons
You can hide specific buttons using SessionSettings:- Kotlin
- Java
Next Steps
Layout Listener
Handle layout change events
Session Settings
Configure button visibility