Prerequisites
- An active call session
- Access to the
CallSessioninstance
Get CallSession Instance
Layout and UI methods are called on theCallSession singleton:
CallSession.getInstance() returns null if no active session exists. Always use the null-aware ?. operator when calling methods.Set Layout
Change the call layout during an active session.LayoutType Enum
When the layout changes, the
onCallLayoutChanged(LayoutType) callback is triggered on your LayoutListener.Set Call Layout Type
Alias forsetLayout(). Changes the call layout.
Picture-in-Picture Mode
Enable Picture-in-Picture (PiP) mode to allow users to continue viewing the call while using other apps.Enable PiP
Disable PiP
Enter PiP Mode
Enter the system Picture-in-Picture mode directly.PiP behavior differs between platforms. Android uses the system PiP window, while iOS uses a custom overlay. Use
isPipSupported() to check availability before calling this method.Set Chat Button Unread Count
Update the badge count on the chat button to show unread messages.The chat button must be visible (
hideChatButton(false)) for the badge to appear.Listen for Layout Events
Register aLayoutListener to receive callbacks when layout changes occur:
Flutter listeners are not lifecycle-aware. You must manually remove listeners in your widget’s
dispose() method to prevent memory leaks.Initial Layout Settings
Configure the initial layout when joining a session:Hide UI Elements
Control the visibility of various UI elements:Button Click Listeners
Listen for UI button clicks to implement custom behavior:Next Steps
Session Control
Leave session and hand raise controls
Layout Listener
Handle all layout events