LayoutListeners. This listener provides callbacks for call layout changes, participant list visibility, and Picture-in-Picture (PiP) mode state changes.
Prerequisites
- An active call session
- Access to the
CallSessioninstance
Register Listener
Set thelayoutListener on the CallSession to receive layout event callbacks:
Callbacks
onCallLayoutChanged
Triggered when the call layout changes between Tile and Spotlight modes.
Use Cases:
- Update layout toggle button icon
- Adjust custom UI overlays
- Log layout preference analytics
onParticipantListVisible
Triggered when the participant list panel becomes visible.- Log analytics events
- Adjust custom UI elements
- Pause other UI animations
onParticipantListHidden
Triggered when the participant list panel is hidden.- Restore UI elements
- Resume animations
- Update button states
onPictureInPictureLayoutEnabled
Triggered when Picture-in-Picture (PiP) mode is enabled.- Hide call control buttons
- Simplify UI for small window
- Track PiP feature usage
onPictureInPictureLayoutDisabled
Triggered when Picture-in-Picture (PiP) mode is disabled.- Restore call control buttons
- Show full call UI
- Resume normal layout
Complete Example
Here’s a complete example handling all layout events:Remove Listener
Remove the layout listener in your widget’sdispose() method to prevent memory leaks:
Controlling Layout Programmatically
You can change the layout and PiP state programmatically:Change Layout
Enable/Disable PiP
Initial Layout Configuration
Set the initial layout when joining a session:Callbacks Summary
Next Steps
Layout & UI
Control layout programmatically
Session Settings
Configure initial layout settings