applyForSeat

abstract fun applyForSeat(seatIndex: Int, timeout: Int, extraInfo: String?, completion: CompletionHandler?)

Apply to go on seat

Apply to Go on Seat

Request to join co-guest session as an audience member.

After calling this method, a co-guest request is sent to all hosts in the live room. The request will remain active until:

Parameter Description

ParameterTypeDescription
seatIndexIntDesired seat position. Use -1 for automatic seat assignment
timeoutIntMaximum wait time (seconds). Range: 10-60 seconds
extraInfoString?Optional metadata (e.g., user introduction, JSON data)
completionCompletionHandler?Callback when request is sent (not when accepted)

Return Value

The completion handler receives:

  • code: 0 for success, otherwise error code

  • message: Success message or error description

Important: This method only confirms the request was successfully sent. Listen to GuestListener to know when host responds to your application.

Tip: If no host responds within the timeout, GuestListener.onGuestApplicationNoResponse event with NoResponseReason.TIMEOUT will be triggered.

Example

// Apply for auto-assigned seat with 30 second timeout
store.applyForSeat(
seatIndex = -1,
timeout = 30,
extraInfo = "{\"level\": \"VIP\"}",
completion = { code, message ->
if (code == 0) {
println("Application sent successfully")
} else {
println("Failed to send application: $message")
}
}
)

// Add guest event listener
store.addGuestListener(object : GuestListener() {
override fun onGuestApplicationResponded(isAccept: Boolean, hostUser: LiveUserInfo) {
if (isAccept) {
println("Application accepted by ${hostUser.userName}!")
} else {
println("Application rejected by ${hostUser.userName}")
}
}
override fun onGuestApplicationNoResponse(reason: NoResponseReason) {
println("No response: $reason")
}
})

Parameters

seatIndex

Seat index, -1 means auto-assign seat

timeout

Timeout (unit: seconds)

extraInfo

Extra information

completion

Completion callback