Skip to main content
Monitor layout changes with LayoutListener. This listener provides callbacks for call layout changes, participant list visibility, and Picture-in-Picture (PiP) mode state changes.

Prerequisites

Register Listener

Register a LayoutListener to receive layout event callbacks:
The listener is automatically removed when the LifecycleOwner (Activity/Fragment) is destroyed, preventing memory leaks.

Callbacks

onCallLayoutChanged

Triggered when the call layout changes between Tile and Spotlight modes.
LayoutType Values: Use Cases:
  • Update layout toggle button icon
  • Adjust custom UI overlays
  • Log layout preference analytics

onParticipantListVisible

Triggered when the participant list panel becomes visible.
Use Cases:
  • Log analytics events
  • Adjust custom UI elements
  • Pause other UI animations

onParticipantListHidden

Triggered when the participant list panel is hidden.
Use Cases:
  • Restore UI elements
  • Resume animations
  • Update button states

onPictureInPictureLayoutEnabled

Triggered when Picture-in-Picture (PiP) mode is enabled.
Use Cases:
  • Hide call control buttons
  • Simplify UI for small window
  • Track PiP feature usage

onPictureInPictureLayoutDisabled

Triggered when Picture-in-Picture (PiP) mode is disabled.
Use Cases:
  • Restore call control buttons
  • Show full call UI
  • Resume normal layout

Complete Example

Here’s a complete example handling all layout events:

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