SeatGridView
Introduction
LiveSeatStore provides a complete set of seat management APIs, including taking seat, leaving seat, locking seat, unlocking seat, kicking user off seat, remote device control, etc. Through this class, seat management functionality can be implemented in the live room.Notice:
Use the LiveSeatStore.create factory method to create a
LiveSeatStore instance, passing a valid live room ID.Note:
Seat state updates are delivered through the liveSeatState publisher. Subscribe to it to receive real-time updates of seat data in the room.
Features
Seat Management: Take seat, leave seat, lock seat, unlock seat operations.
User Management: Kick user off seat, move user to specified seat.
Featured Host Management: In templates that support a featured host slot, set a seated user as a featured host or remove a featured host.
Device Control: Remote control of user's camera and microphone.
Event Listening: Listen to seat-related events.
Subscribable Data
LiveSeatState fields are described below:
Property | Type | Description |
seatList | Seat list. | |
canvas | Canvas information. | |
speakingUsers | StateFlow<MutableMap<String, Int>> | Speaking users. |
avStatistics | Audio and video statistics. | |
seatMode | Take seat mode of the current room, supports real-time updates and can be subscribed to. |
API List
Function | Description |
Create seat management instance. | |
Seat event callbacks. | |
Seat event callbacks. | |
Take seat. | |
Leave seat. | |
Lock seat. | |
Unlock seat. | |
Kick user off seat. | |
Move user. | |
Set the take seat mode. | |
Set a featured host. | |
Revoke a featured host. | |
Open remote camera. | |
Close remote camera. | |
Open remote microphone. | |
Close remote microphone. |
Creating Instance
LiveSeatStore.create
Create seat management instance.
Observing State and Events
addLiveSeatEventListener
Add seat event listener.
abstract fun addLiveSeatEventListener(listener: LiveSeatListener?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
listener | Listener. |
removeLiveSeatEventListener
Remove seat event listener.
abstract fun removeLiveSeatEventListener(listener: LiveSeatListener?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
listener | Listener. |
Seat Operations
takeSeat
Take seat.
abstract fun takeSeat(seatIndex: Int,completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
seatIndex | Int | Seat index. |
completion | Completion callback. |
leaveSeat
Leave seat.
abstract fun leaveSeat(completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
completion | Completion callback. |
lockSeat
Lock seat.
abstract fun lockSeat(seatIndex: Int,completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
seatIndex | Int | Seat index. |
completion | Completion callback. |
unlockSeat
Unlock seat.
abstract fun unlockSeat(seatIndex: Int,completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
seatIndex | Int | Seat index. |
completion | Completion callback. |
User Management
kickUserOutOfSeat
Kick user off seat.
abstract fun kickUserOutOfSeat(userID: String?,completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
userID | String? | User ID. |
completion | Completion callback. |
moveUserToSeat
Move user to seat.
abstract fun moveUserToSeat(userID: String?,targetIndex: Int,policy: MoveSeatPolicy? = MoveSeatPolicy.ABORT_WHEN_OCCUPIED,completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
userID | String? | User ID. |
targetIndex | Int | Target seat index. |
policy | Move policy. | |
completion | Completion callback. |
Seat Mode
setSeatMode
Set the take seat mode of the current room. After setting successfully, the LiveSeatState.seatMode state will be updated. Subscribe to it to receive real-time updates.
abstract fun setSeatMode(mode: SeatMode,completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
mode | Take seat mode (SeatMode.FREE free to take seat / SeatMode.APPLY apply to take seat). | |
completion | Completion callback (success/failure status). |
Featured Host Management
setFeaturedHost
Set featured host.
abstract fun setFeaturedHost(userID: String,completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
userID | String | User ID. |
completion | Completion callback. |
revokeFeaturedHost
Revoke featured host.
abstract fun revokeFeaturedHost(userID: String,completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
userID | String | User ID. |
completion | Completion callback. |
Remote Device Control
openRemoteCamera
Open remote camera.
abstract fun openRemoteCamera(userID: String?,policy: DeviceControlPolicy,completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
userID | String? | User ID. |
policy | Device control policy. | |
completion | Completion callback. |
closeRemoteCamera
Close remote camera.
abstract fun closeRemoteCamera(userID: String?,completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
userID | String? | User ID. |
completion | Completion callback. |
openRemoteMicrophone
Open remote microphone.
abstract fun openRemoteMicrophone(userID: String?,policy: DeviceControlPolicy,completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
userID | String? | User ID. |
policy | Device control policy. | |
completion | Completion callback. |
closeRemoteMicrophone
Close remote microphone.
abstract fun closeRemoteMicrophone(userID: String?,completion: CompletionHandler?)internal val hasAudioStreamUserList: MutableSet<String> = mutableSetOf()internal val hasVideoStreamUserList: MutableSet<String> = mutableSetOf()
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
userID | String? | User ID. |
completion | Completion callback. |
Data Structures
MoveSeatPolicy
Move seat policy.
Enum Value | Description |
ABORT_WHEN_OCCUPIED | Abort when occupied. |
FORCE_REPLACE | Force replace. |
SWAP_POSITION | Swap position. |
DeviceControlPolicy
Device control policy.
Enum Value | Description |
UNLOCK_ONLY | Unlock only. |
SuspendStatus
User suspend status.
Enum Value | Description |
NONE | Not suspended. |
IN_BACKGROUND | User suspended in background. |
IN_CALLING | User is on a phone call. |
SeatMode
Take seat mode.
Enum Value | Description |
FREE | Free to take seat. |
APPLY | Apply to take seat. |
LiveSeatListener
Seat related callback events.
Methods
Method | Description |
onLocalCameraOpenedByAdmin | Triggered when the local camera is opened by an admin. |
onLocalCameraClosedByAdmin | Triggered when the local camera is closed by an admin. |
onLocalMicrophoneOpenedByAdmin | Triggered when the local microphone is opened by an admin. |
onLocalMicrophoneClosedByAdmin | Triggered when the local microphone is closed by an admin. |
SeatUserInfo
Seat user information.
Property | Type | Description |
userID | String | User ID. |
userName | String | User name. |
avatarURL | String | Avatar URL. |
role | User role. | |
liveID | String | Live room ID. |
microphoneStatus | Microphone status. | |
allowOpenMicrophone | Boolean | Whether microphone can be opened. |
cameraStatus | Camera status. | |
allowOpenCamera | Boolean | Whether camera can be opened. |
userSuspendStatus | User suspend status. |
RegionInfo
Seat view coordinate information.
Property | Type | Description |
x | Int | X coordinate. |
y | Int | Y coordinate. |
w | Int | Width. |
h | Int | Height. |
zorder | Int | Z-order. |
AVStatistics
Audio and video statistics information.
Property | Type | Description |
userID | String | User ID. |
videoBitrate | Int | Local video bitrate. |
videoWidth | Int | Local video width. |
videoHeight | Int | Local video height. |
frameRate | Int | Local video frame rate. |
audioSampleRate | Int | Audio sample rate. |
audioBitrate | Int | Audio bitrate. |
SeatInfo
Seat information.
Property | Type | Description |
index | Int | Seat index. |
isLocked | Boolean | Whether locked. |
userInfo | User information. | |
region | Region information. | |
isFeaturedHost | Boolean | Whether the user on this seat is currently a featured host. Can only be true in templates that support featured host slots. |
LiveCanvas
Live canvas.
Property | Type | Description |
w | Int | Width. |
h | Int | Height. |
templateID | Int | Template ID. |
LiveSeatState
Seat state data provided by LiveSeatStore.
Property | Type | Description |
seatList | Seat list. | |
canvas | Canvas information. | |
speakingUsers | StateFlow<MutableMap<String, Int>> | Speaking users. |
avStatistics | Audio and video statistics. | |
seatMode | Take seat mode of the current room, supports real-time updates and can be subscribed to. |
