SeatGridView
.SeatGridView
supports the following seat management capabilities:SeatGridView
, you need to integrate and log in to SeatGridView to ensure the subsequent features work properly.SeatGridView
module first, then create a SeatGridView object and add it to your view.
applyToTake
)", applying to speak requires the room owner's approval.freeToTake
)", applying to speak does not require the room owner's approval and can be done directly.takeSeat
API and pass in two parameters: seat index and timeout duration.let index = 1 // Please replace this with the seat number you want to apply for (context: code line content)let timeout = 30 // Please replace this with the timeout duration for your speaking request, in seconds. If set to 0, the SDK will not perform timeout detection or trigger timeout callbacks.self.seatGridView.takeSeat(index: index, timeout: timeout) { userInfo in// Speaking request accepted} onRejected: { userInfo in// Speaking request rejected} onCancelled: { userInfo in// Speaking request canceled} onTimeout: { userInfo in// Speaking request timed out} onError: { userInfo, code, message in// Speaking request error}
int index = 1; // Please replace this with the seat number you want to apply for (context: code line content)int timeout = 30; // Replace this with the timeout duration for requesting to speak, in seconds. If set to 0, the SDK will not perform timeout detection or trigger timeout callbacksseatGridView.takeSeat(index, timeout, new TUIRoomDefine.RequestCallback() {@Overridepublic void onAccepted(String requestId, String userId) {// Speaking request accepted}@Overridepublic void onRejected(String requestId, String userId, String message) {// Speaking request rejected}@Overridepublic void onCancelled(String requestId, String userId) {// Speaking request canceled}@Overridepublic void onTimeout(String requestId, String userId) {// Speaking request timed out}@Overridepublic void onError(String requestId, String userId, TUICommonDefine.Error error, String message) {// Speaking request error}});
onSeatRequestReceived
callback. You can call responseRemoteRequest
to accept/reject the speaking request.func onSeatRequestReceived(type: SGRequestType, userInfo: TUIUserInfo) {if type == .applyToTakeSeat {let agree = true // true meansself.seatGridView.responseRemoteRequest(userId: userInfo.userId, agree: true) {// Agreed to speak successfully} onError: { code, message in// Failed to agree to speak}}}
void onSeatRequestReceived(VoiceRoomDefine.RequestType type, TUIRoomDefine.UserInfo userInfo) {if (type == APPLY_TO_TAKE_SEAT) {boolean agree = true; // true: agree to connect, false: refuse to connectseatGridView.seatGridView.responseRemoteRequest(userInfo.userId, agree, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess () {// Agreed to speak successfully}@Overridepublic void onError (TUICommonDefine.Error error, String message) {// Agreed to speak successfully}});}}
leaveSeat
API.self.seatGridView.leaveSeat {// Left the seat successfully} onError: { code, message in// Failed to leave the seat}
seatGridView.leaveSeat(new TUIRoomDefine.ActionCallback {@Overridepublic void onSuccess () {// Left the seat successfully}@Overridepublic void onError (TUICommonDefine.Error error, String message) {// Failed to leave the seat}});
moveToSeat
API and pass in the index of the seat to switch to.let index = 2self.seatGridView.moveToSeat(index: destinationIndex) {// Successfully moved the seat} onError: { code, message in// Failed to move the seat}
int index = 2;seatGridView.moveToSeat(index, new TUIRoomDefine.ActionCallback {@Overridepublic void onSuccess () {// Successfully moved the seat}@Overridepublic void onError (TUICommonDefine.Error error, String message) {// Failed to move the seat}});
takeUserOnSeatByAdmin
API, passing three parameters: the seat index to invite to, the timeout period, and the user ID of the person being invited.let tartgetIndex = 4let timeout = 30let targetUserId = "100002" // Please replace this with the user ID of the host you want to remove from the mic.self.takeUserOnSeatByAdmin(index: targetIndex, timeout: timeout, userId: targetUserId) {// Speaking invitation accepted} onRejected: { userInfo in// Speaking invitation rejected} onTimeout: { userInfo in// Speaking invitation timed out} onCancelled: { userInfo in// Speaking invitation canceled} onError: { userInfo, code, message in// Speaking invitation error}
int tartgetIndex = 4;int timeout = 30;String targetUserId = "100002"; // Please replace this with the user ID of the host you want to remove from the mic.seatGridView.takeUserOnSeatByAdmin(targetIndex, timeout, targetUserId, new new TUIRoomDefine.RequestCallback() {@Overridepublic void onAccepted(String requestId, String userId) {// Speaking invitation accepted}@Overridepublic void onRejected(String requestId, String userId, String message) {// Speaking invitation rejected}@Overridepublic void onCancelled(String requestId, String userId) {// Speaking invitation canceled}@Overridepublic void onTimeout(String requestId, String userId) {// Speaking invitation timed out}@Overridepublic void onError(String requestId, String userId, TUICommonDefine.Error error, String message) {// Speaking invitation error}});
responseRemoteRequest
to accept/reject the speaking invitation.func onSeatRequestReceived(type: SGRequestType, userInfo: TUIUserInfo) {if type == .inviteToTakeSeat {let isAccepted = true // true means accepting the invitation, false means rejecting the invitationself.seatGridView.responseRemoteRequest(userId: userInfo.userId, agree: isAccepted) {// Agreed to speak invitation successfully} onError: { code, message in// Failed to agree to speak invitation}}}
void onSeatRequestReceived(VoiceRoomDefine.RequestType type, TUIRoomDefine.UserInfo userInfo) {if (type == INVITE_TO_TAKE_SEAT) {boolean isAccepted = true; // true means accepting the invitation, false means rejecting the invitationseatGridView.responseRemoteRequest(userInfo.userId, isAccepted, new TUIRoomDefine.ActionCallback {@Overridepublic void onSuccess () {// Agreed to speak invitation successfully}@Overridepublic void onError (TUICommonDefine.Error error, String message) {// Failed to agree to speak invitation}});}}
kickUserOffSeatByAdmin
API and pass in the user ID of the speaker you want to remove.String targetUserId = "100002"; // Please replace this with the user ID of the host you want to remove from the mic.seatGridView.kickUserOffSeatByAdmin(targetUserId, new TUIRoomDefine.ActionCallback {@Overridepublic void onSuccess () {// Successfully removed a speaker}@Overridepublic void onError (TUICommonDefine.Error error, String message) {// Failed to remove a speaker}});
String targetUserId = "100002"; // Please replace this with the user ID of the host you want to remove from the mic.self.seatGridView.kickUserOffSeatByAdmin(targetUserId, new TUIRoomDefine.ActionCallback {@Overridepublic void onSuccess () {// Successfully removed a speaker}@Overridepublic void onError (TUICommonDefine.Error error, String message) {// Failed to remove a speaker}});
lockSeat
API, passing in two parameters: the index of the seat to be locked and the lock mode.TUISeatLockParams
) is as follows:Property Name | Field Description | Additional Notes | Data Type | Example |
lockSeat | Lock Microphone Position | Locking the corresponding seat prevents applications to take that seat. | Boolean value | True when the seat is locked. |
lockVideo | Lock the seat camera. | Locking the corresponding seat camera will stop the seat from publishing video streams. | Boolean value | false |
lockAudio | Lock the seat microphone. | Locking the corresponding seat camera will stop the seat from publishing audio streams. | Boolean value | True when the seat microphone is locked. |
// Lock a seat.let lockSeatIndex = 5let lockSeatParam = TUISeatLockParams()lockSeatParam.lockSeat = trueself.seatGridView.lockSeat(index: lockSeatIndex, lockMode: lockSeatParam) {// Lock the seat successfully} onError: { code, message in// Failed to lock the seat}// Lock the seat microphonelet lockSeatAudioIndex = 6let lockSeatAudioParam = TUISeatLockParams()lockSeatAudioParam.lockAudio = trueself.seatGridView.lockSeat(index: lockSeatAudioIndex, lockMode: lockSeatAudioParam) {// Lock the seat microphone successfully} onError: { code, message in// Failed to lock the seat microphone}
// Lock a seat.int lockSeatIndex = 5;TUIRoomDefine.SeatLockParams lockSeatParam = new TUIRoomDefine.SeatLockParams();lockSeatParam.lockSeat = true;seatGridView.lockSeat(lockSeatIndex, lockSeatParam, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Lock the seat successfully}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Failed to lock the seat}});// Lock the seat microphoneint lockSeatIndex = 6;TUIRoomDefine.SeatLockParams lockSeatAudioParam = new TUIRoomDefine.SeatLockParams();lockSeatAudioParam.lockAudio = true;seatGridView.lockSeat(lockSeatIndex, lockSeatAudioParam, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Lock the seat microphone successfully}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Failed to lock the seat microphone}});
Was this page helpful?