Skip to main content
Choose how participants are displayed during a call. The SDK provides multiple layout options to suit different use cases like team meetings, presentations, or one-on-one calls.

Available Layouts

LayoutDescriptionBest For
TILEGrid layout with equally-sized tiles for all participantsTeam meetings, group discussions
SPOTLIGHTLarge view for the other participant, small tile for yourselfOne-on-one calls, presentations, webinars
SIDEBARMain speaker with participants in a sidebarInterviews, panel discussions

Set Initial Layout

Configure the layout when joining a session using SessionSettingsBuilder:
val sessionSettings = CometChatCalls.SessionSettingsBuilder()
    .setLayout(LayoutType.TILE)
    .build()

CometChatCalls.joinSession(sessionId, sessionSettings, callViewContainer,
    object : CometChatCalls.CallbackListener<CallSession>() {
        override fun onSuccess(callSession: CallSession) {
            Log.d(TAG, "Joined with TILE layout")
        }

        override fun onError(e: CometChatException) {
            Log.e(TAG, "Failed: ${e.message}")
        }
    }
)

Change Layout During Call

Switch layouts dynamically during an active call using setLayout():
val callSession = CallSession.getInstance()

// Switch to Spotlight layout
callSession.setLayout(LayoutType.SPOTLIGHT)

// Switch to Tile layout
callSession.setLayout(LayoutType.TILE)

// Switch to Sidebar layout
callSession.setLayout(LayoutType.SIDEBAR)
Each participant can choose their own layout independently. Changing your layout does not affect other participants.

Listen for Layout Changes

Monitor layout changes using LayoutListener:
val callSession = CallSession.getInstance()

callSession.addLayoutListener(this, object : LayoutListener() {
    override fun onCallLayoutChanged(layoutType: LayoutType) {
        when (layoutType) {
            LayoutType.TILE -> Log.d(TAG, "Switched to Tile layout")
            LayoutType.SPOTLIGHT -> Log.d(TAG, "Switched to Spotlight layout")
            LayoutType.SIDEBAR -> Log.d(TAG, "Switched to Sidebar layout")
        }
        // Update layout toggle button icon
        updateLayoutIcon(layoutType)
    }

    override fun onParticipantListVisible() {}
    override fun onParticipantListHidden() {}
    override fun onPictureInPictureLayoutEnabled() {}
    override fun onPictureInPictureLayoutDisabled() {}
})

Hide Layout Toggle Button

To prevent users from changing the layout, hide the layout toggle button in the call UI:
val sessionSettings = CometChatCalls.SessionSettingsBuilder()
    .setLayout(LayoutType.SPOTLIGHT) // Fixed layout
    .hideChangeLayoutButton(true)    // Hide toggle button
    .build()