RTC Room Engine SDK to implement audience mic connection feature.RTC Room Engine supports the following seat management capabilities:RTC RoomEngine SDK, you need to call log in to the SDK so that subsequent features can be used normally.updateRoomSeatModeByAdmin API implementation by passing in the seat mode seatMode as an input parameter.TUISeatMode.Enumerated Value Type | Meaning |
freeToTake | Applying to speak no longer requires the room owner's approval and you can speak directly. |
applyToTake | Need to wait for host approval to take seat. |
updateRoomSeatModeByAdmin API implementation by passing in the seat mode seatMode as an input parameter.SeatMode.Enumerated Value Type | Meaning |
FREE_TO_TAKE | Applying to speak no longer requires the room owner's approval and you can speak directly. |
APPLY_TO_TAKE | Need to wait for host approval to take seat. |
import RTCRoomEnginelet seatMode: TUISeatMode =.applyToTake // Select apply for microphone mode here. If you need to select free-speaking mode, it can be changed to.freeToTakeTUIRoomEngine.sharedInstance().updateRoomSeatModeByAdmin(seatMode) {// Successfully set the seat response configuration} onError: { code, message in// Failed to set the seat response configuration}
TUIRoomDefine.SeatMode seatMode = TUIRoomDefine.SeatMode.APPLY_TO_TAKE; // Select apply for microphone mode here. If you need to select free-speaking mode, it can be changed to.freeToTakeTUIRoomEngine.sharedInstance().updateRoomSeatModeByAdmin(seatMode, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Successfully set the mic on response configuration}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Failed to set the seat response configuration}});
getSeatList API to obtain the current seat list information.import RTCRoomEngineTUIRoomEngine.sharedInstance().getSeatList { seatList in// Successfully get seat list} onError: { code, message in// Fail to get seat list}
TUIRoomEngine.sharedInstance().getSeatList(new TUIRoomDefine.GetSeatListCallback() {@Overridepublic void onSuccess(List<TUIRoomDefine.SeatInfo> list) {// Successfully get seat list}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Fail to get seat list}});
getSeatApplicationList API to obtain the current Microphone Request List information.import RTCRoomEngineTUIRoomEngine.sharedInstance().getSeatApplicationList { applications in// Succeed in getting Microphone Request List} onError: { code, message in// Fail to get Microphone Request List}
TUIRoomEngine.sharedInstance().getSeatApplicationList(new TUIRoomDefine.RequestListCallback() {@Overridepublic void onSuccess(List<TUIRoomDefine.Request> list) {// Succeed in getting Microphone Request List}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Fail to get Microphone Request List}});
takeSeat API, importing two parameters: the seat index you want to apply for and the timeout duration.import RTCRoomEnginelet index = 1 // Please replace this with the seat number you want to apply forlet timeout = 30 // Please replace this with the timeout period for your microphone request, in seconds. If set to 0, the SDK will not perform timeout detection or trigger a timeout callback.TUIRoomEngine.sharedInstance().takeSeat(index, timeout: TimeInterval(timeout)) { requestId, userId in// Seat-taking application accepted} onRejected: { requestId, userId, message in// Seat-taking application rejected} onCancelled: { requestId, userId in// Seat-taking application canceled} onTimeout: { requestId, userId in// Seat-taking application timed out} onError: { requestId, userId, code, message in// Seat-taking exception}
int index = 1; // Please replace this with the seat number you want to apply forint timeout = 30; // Please replace this with the timeout period for your microphone request, in seconds. If set to 0, the SDK will not perform timeout detection or trigger a timeout callback.TUIRoomEngine.sharedInstance().takeSeat(index, timeout, new TUIRoomDefine.RequestCallback() {@Overridepublic void onAccepted(String requestId, String userId) {// Seat-taking application accepted}@Overridepublic void onRejected(String requestId, String userId, String message) {// Seat-taking application rejected}@Overridepublic void onCancelled(String requestId, String userId) {// Seat-taking application canceled}@Overridepublic void onTimeout(String requestId, String userId) {// Seat-taking application timed out}@Overridepublic void onError(String requestId, String userId, TUICommonDefine.Error error, String message) {// Seat-taking exception}});
RTC Room Engine SDK through the addObserver API, you will receive the onRequestReceived callback when someone applies for microphone mode. You can confirm it by responseRemoteRequest or reject the request.func onRequestReceived(request: TUIRequest) {if request.requestAction == .takeSeat {let agreeToTakeSeat = true // If you want to reject the request to speak, set it to false here.TUIRoomEngine.sharedInstance().responseRemoteRequest(request.requestId, agree: agreeToTakeSeat) {// Handle seat request successfully} onError: { code, message in// Seat request handling failed}}}
public void onRequestReceived(TUIRoomDefine.Request request) {if (TUIRoomDefine.RequestAction.REQUEST_TO_TAKE_SEAT == request.requestAction) {boolean agreeToTakeSeat = true; // If you want to reject the request to speak, set it to false here.TUIRoomEngine.sharedInstance().responseRemoteRequest(request.requestId, agreeToTakeSeat, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Handle seat request successfully}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Seat request handling failed}});}}
leaveSeat API.import RTCRoomEngineTUIRoomEngine.sharedInstance().leaveSeat {// Successfully became a listener.} onError: { code, message in// Failed to leave the seat.}
TUIRoomEngine.sharedInstance().leaveSeat(new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Successfully became a listener.}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Failed to become a speaker.}});
moveToSeat API to implement the move seat feature. Input parameter: the index of the seat you want to move to.import RTCRoomEnginelet targetIndex = 2TUIRoomEngine.sharedInstance().moveToSeat(targetSeatIndex: targetIndex) {// Successfully moved the seat.} onError: { code, message in// Failed to move seat.}
int targetIndex = 2;TUIRoomEngine.sharedInstance().moveToSeat(targetIndex, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Successfully moved the seat.}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Failed to move the seat.}});
kickUserOffSeatByAdmin API, with the incoming parameter: the user Id of the user to be removed.import RTCRoomEnginelet targetIndex = -1 // Set this value to -1. Other values are meaningless.let userId = "100001" // Replace it with the user you need to kick off the mic.TUIRoomEngine.sharedInstance().kickUserOffSeatByAdmin(targetIndex, userId: userId) {// Successfully remove a speaker.} onError: { code, message in// Failed to remove a speaker.}
int targetIndex = -1; // Set this value to -1. Other values are meaningless.String userId = "100001"; // Replace it with the user you need to kick off the mic.TUIRoomEngine.sharedInstance().kickUserOffSeatByAdmin(targetIndex, userId, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Successfully remove a speaker.}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Failed to remove a speaker.}});
takeUserOnSeatByAdmin API, importing three parameters: the seat index to be operated on, the user Id of the user to be invited, and the timeout duration.import RTCRoomEnginelet targetIndex = 4let timeout = 30 // Please replace this with the timeout period for your microphone request, in seconds. If set to 0, the SDK will not perform timeout detection or trigger a timeout callback.let targetUserId = "100002" // Replace it with the user ID of the audience you want to Invitation to Speak.TUIRoomEngine.sharedInstance().takeUserOnSeatByAdmin(targetIndex,userId: targetUserId,timeout: TimeInterval(timeout)) { requestId, userId in// Seat-taking invitation accepted} onRejected: { requestId, userId, message in// Seat-taking invitation rejected} onCancelled: { requestId, userId in// Seat-taking invitation canceled} onTimeout: { requestId, userId in// Seat-taking invitation timed out} onError: { requestId, userId, code, message in// Seat-taking invitation exception}
int targetIndex = 4;int timeout = 30; // Please replace this with the timeout period for your request to speak, in seconds. If set to 0, the SDK will not perform timeout detection or trigger a timeout callback.String targetUserId = "100002"; // Replace it with the user ID of the audience you want to Invitation to Speak.TUIRoomEngine.sharedInstance().takeUserOnSeatByAdmin(targetIndex, targetUserId, timeout, new TUIRoomDefine.RequestCallback() {@Overridepublic void onAccepted(String requestId, String userId) {// Seat-taking invitation accepted}@Overridepublic void onRejected(String requestId, String userId, String message) {// Seat-taking invitation rejected}@Overridepublic void onCancelled(String requestId, String userId) {// Seat-taking invitation canceled}@Overridepublic void onTimeout(String requestId, String userId) {// Seat-taking invitation timed out}@Overridepublic void onError(String requestId, String userId, TUICommonDefine.Error error, String message) {// Seat-taking invitation exception}});
RTC Room Engine SDK by calling the addObserver API, you will receive the onRequestReceived callback when someone invites you to speak. You can call responseRemoteRequest to accept/reject the other party's Microphone Invitation.func onRequestReceived(request: TUIRequest) {if request.requestAction == .remoteUserOnSeat {let agreeToTakeSeat = true // If you want to reject the Microphone Invitation, set it to false here.TUIRoomEngine.sharedInstance().responseRemoteRequest(request.requestId,agree: agreeToTakeSeat) {// Handle seat invitation successfully} onError: { code, message in// Seat invitation handling failed}}}
public void onRequestReceived(TUIRoomDefine.Request request) {if (TUIRoomDefine.RequestAction.REQUEST_REMOTE_USER_ON_SEAT == request.requestAction) {boolean agreeToTakeSeat = true; // If you want to reject the Microphone Invitation, set it to false here.TUIRoomEngine.sharedInstance().responseRemoteRequest(request.requestId, agreeToTakeSeat, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Handle seat invitation successfully}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Handle seat invitation failure}});}}
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 | Fill in an Example |
lockSeat | Locking a Seat | Locking the corresponding seat means that the seat is not allowed to apply for speaking. | Boolean value | true when the seat is locked. |
lockVideo | Lock the seat camera. | Locking the corresponding seat camera will stop the video stream from that seat. | Boolean value | true when the seat camera is locked. |
lockAudio | Lock the seat microphone. | Locking the corresponding seat microphone will stop the audio stream from that seat. | Boolean value | true when the seat microphone is locked. |
lockSeat API, passing in two parameters: the index of the seat to be locked and the lock mode.SeatLockParams) is as follows:Property Name | Field Description | Additional Notes | Data Type | Fill in an Example |
lockSeat | Locking a Seat | Locking the corresponding seat means that the seat is not allowed to apply for speaking. | Boolean value | true when the seat is locked. |
lockVideo | Lock the seat camera. | Locking the corresponding seat camera will stop the video stream from that seat. | Boolean value | true when the seat camera is locked. |
lockAudio | Lock the seat microphone. | Locking the corresponding seat microphone will stop the audio stream from that seat. | Boolean value | true when the seat microphone is locked. |
lockSeatByAdmin API.import RTCRoomEngine// Lock a seat.let lockSeatIndex = 5let lockSeatParam = TUISeatLockParams()lockSeatParam.lockSeat = trueTUIRoomEngine.sharedInstance().lockSeatByAdmin(lockSeatIndex,lockMode: lockSeatParam) {// Successfully lock the seat.} onError: { code, message in// Failed to lock the seat.}// Lock the seat microphone.let lockSeatAudioIndex = 6let lockSeatAudioParam = TUISeatLockParams()lockSeatAudioParam.lockAudio = trueTUIRoomEngine.sharedInstance().lockSeatByAdmin(lockSeatAudioIndex,lockMode: lockSeatAudioParam) {// Successfully lock the seat microphone.} onError: { code, message in// Failed to lock the seat microphone.}// Lock the seat camera.let lockSeatVideoIndex = 7let lockSeatVideoParam = TUISeatLockParams()lockSeatVideoParam.lockVideo = trueTUIRoomEngine.sharedInstance().lockSeatByAdmin(lockSeatVideoIndex,lockMode: lockSeatVideoParam) {// Successfully lock the seat camera.} onError: { code, message in// Lock seat camera failed.}
// Lock a seat.int lockSeatIndex = 5;TUIRoomDefine.SeatLockParams lockSeatParam = new TUIRoomDefine.SeatLockParams();lockSeatParam.lockSeat = true;TUIRoomEngine.sharedInstance().lockSeatByAdmin(lockSeatIndex, lockSeatParam, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Successfully lock the seat.}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Failed to lock the seat.}});// Lock the seat microphone.int lockSeatAudioIndex = 6;TUIRoomDefine.SeatLockParams lockSeatAudioParam = new TUIRoomDefine.SeatLockParams();lockSeatAudioParam.lockAudio = true;TUIRoomEngine.sharedInstance().lockSeatByAdmin(lockSeatAudioIndex, lockSeatAudioParam, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Successfully lock the seat microphone.}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Failed to lock the seat microphone.}});// Lock the seat camera.int lockSeatVideoIndex = 7;TUIRoomDefine.SeatLockParams lockSeatVideoParam = new TUIRoomDefine.SeatLockParams();lockSeatVideoParam.lockVideo = true;TUIRoomEngine.sharedInstance().lockSeatByAdmin(lockSeatVideoIndex, lockSeatVideoParam, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Lock seat camera successfully}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Lock seat camera failed.}});
RTC Room Engine SDK by calling addObserver to listen to seat-related callbacks.CoGuestController becoming an observer as an example:import RTCRoomEngineclass CoGuestController: NSObject, TUIRoomObserver { // Please replace this with your business class. This is just a sample.override init() {super.init()TUIRoomEngine.sharedInstance().addObserver(self)}deinit {TUIRoomEngine.sharedInstance().removeObserver(self)}// Triggered when the room microphone mode changesfunc onRoomSeatModeChanged(roomId: String, seatMode: TUISeatMode) {// The seat mode of the room has changed. Current mode: seatMode}// Triggered when the seat position list changesfunc onSeatListChanged(seatList: [TUISeatInfo], seated seatedList: [TUISeatInfo], left leftList: [TUISeatInfo]) {// The seat position list has changed. List of the latest users on the mic: seatList. List of users who have just taken the microphone: seatedList. List of users who have just left the microphone: leftList.}// Triggered when receiving other users' requestsfunc onRequestReceived(request: TUIRequest) {switch request.requestAction {case .takeSeat:// Received a request to speak from request.userNamecase .remoteUserOnSeat:// Received a Microphone Invitation from request.userNamedefault:break}}// Triggered when other users cancel the requestfunc onRequestCancelled(request: TUIRequest, operateUser: TUIUserInfo) {switch request.requestAction {case .takeSeat:// The request to speak from request.userName has been canceled.case .remoteUserOnSeat:// The seat-taking invitation from request.userName has been canceled.default:break}}// Triggered when a request is processed by another administrator/room ownerfunc onRequestProcessed(request: TUIRequest, operateUser: TUIUserInfo) {switch request.requestAction {case .takeSeat:// The request to speak from request.userName has been processed by operateUser.userName.case .remoteUserOnSeat:// The microphone invitation from request.userName has been processed by operateUser.userName.default:break}}}
RTC Room Engine SDK by calling addObserver to listen to seat-related callbacks.CoGuestObserver becoming an observer as an example:class CoGuestObserver extends TUIRoomObserver { // Please replace this with your business class. This is just a sample.CoGuestObserver() {TUIRoomEngine.sharedInstance().addObserver(this);}// Triggered when the room microphone mode changes@Overridepublic void onRoomSeatModeChanged(String roomId, TUIRoomDefine.SeatMode seatMode) {// The seat mode of the room has changed. Current mode: seatMode}// Triggered when the seat position list changes@Overridepublic void onSeatListChanged(List<TUIRoomDefine.SeatInfo> seatList, List<TUIRoomDefine.SeatInfo> seatedList,List<TUIRoomDefine.SeatInfo> leftList) {// The seat position list has changed. List of the latest users on the mic: seatList. List of users who have just taken the microphone: seatedList. List of users who have just left the microphone: leftList.}// Triggered when receiving other users' requests@Overridepublic void onRequestReceived(TUIRoomDefine.Request request) {switch (request.requestAction) {case REQUEST_TO_TAKE_SEAT:// Received a request to speak from request.userNamecase REQUEST_REMOTE_USER_ON_SEAT:// Received a Microphone Invitation from request.userNamedefault:break;}}// Triggered when other users cancel the request@Overridepublic void onRequestCancelled(TUIRoomDefine.Request request, TUIRoomDefine.UserInfo operateUser) {switch (request.requestAction) {case REQUEST_TO_TAKE_SEAT:// The request to speak from request.userName has been canceled.case REQUEST_REMOTE_USER_ON_SEAT:// The seat-taking invitation from request.userName has been canceled.default:break;}}// Triggered when a request is processed by another administrator/room owner@Overridepublic void onRequestProcessed(TUIRoomDefine.Request request, TUIRoomDefine.UserInfo operateUser) {switch (request.requestAction) {case REQUEST_TO_TAKE_SEAT:// The request to speak from request.userName has been processed by operateUser.userName.case REQUEST_REMOTE_USER_ON_SEAT:// The microphone invitation from request.userName has been processed by operateUser.userName.default:break;}}}
Feedback