• 서비스
  • 가격
  • 리소스
  • 기술지원
이 페이지는 현재 영어로만 제공되며 한국어 버전은 곧 제공될 예정입니다. 기다려 주셔서 감사드립니다.

Mic Connect

this document primarily introduces how to use RTC Room Engine SDK to implement audience mic connection feature.
RTC Room Engine supports the following seat management capabilities:

Prerequisites

Before using the RTC RoomEngine SDK, you need to call log in to the SDK so that subsequent features can be used normally.

User Guide

Note:
When using seat management, make sure that you have already started live streaming or entered the live streaming room.

Seat Response Configuration

iOS
Android
When you are the room owner, you can call the updateRoomSeatModeByAdmin API implementation by passing in the seat mode seatMode as an input parameter.
seatMode is an enumeration of type 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.
When you are the room owner, you can call the updateRoomSeatModeByAdmin API implementation by passing in the seat mode seatMode as an input parameter.
seatMode is an enumeration of type 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.
Take updating the corresponding configuration for applying for microphone mode as an example:
iOS
Android
import RTCRoomEngine

let seatMode: TUISeatMode =.applyToTake // Select apply for microphone mode here. If you need to select free-speaking mode, it can be changed to.freeToTake
TUIRoomEngine.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.freeToTake
TUIRoomEngine.sharedInstance().updateRoomSeatModeByAdmin(seatMode, new TUIRoomDefine.ActionCallback() {
@Override
public void onSuccess() {
// Successfully set the mic on response configuration
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
// Failed to set the seat response configuration
}
});

Get Seat List

You can call the getSeatList API to obtain the current seat list information.
iOS
Android
import RTCRoomEngine

TUIRoomEngine.sharedInstance().getSeatList { seatList in
// Successfully get seat list
} onError: { code, messagea in
// Fail to get seat list
}
TUIRoomEngine.sharedInstance().getSeatList(new TUIRoomDefine.GetSeatListCallback() {
@Override
public void onSuccess(List<TUIRoomDefine.SeatInfo> list) {
// Successfully get seat list
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
// Fail to get seat list
}
});

Get Microphone Request List

You can call the getSeatApplicationList API to obtain the current Microphone Request List information.
iOS
Android
import RTCRoomEngine

TUIRoomEngine.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() {
@Override
public void onSuccess(List<TUIRoomDefine.Request> list) {
// Succeed in getting Microphone Request List
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
// Fail to get Microphone Request List
}
});

Requesting to Speak

When you are not in the microphone mode, you can request to speak by calling the takeSeat API, importing two parameters: the seat index you want to apply for and the timeout duration.
Take requesting to speak for seat No.1 as an example:
iOS
Android
import RTCRoomEngine

let index = 1 // Please replace this with the seat number you want to apply for
let 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 for
int 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() {
@Override
public void onAccepted(String requestId, String userId) {
// Seat-taking application accepted
}
@Override
public void onRejected(String requestId, String userId, String message) {
// Seat-taking application rejected
}
@Override
public void onCancelled(String requestId, String userId) {
// Seat-taking application canceled
}
@Override
public void onTimeout(String requestId, String userId) {
// Seat-taking application timed out
}

@Override
public void onError(String requestId, String userId, TUICommonDefine.Error error, String message) {
// Seat-taking exception
}
});
When you are the room owner, if you become an observer of the 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.
iOS
Android
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() {
@Override
public void onSuccess() {
// Handle seat request successfully
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
// Seat request handling failed
}
});
}
}

Become a listener.

When you are already in the seat, you can become a listener by calling the leaveSeat API.
iOS
Android
import RTCRoomEngine

TUIRoomEngine.sharedInstance().leaveSeat {
// Successfully became a listener.
} onError: { code, message in
// Failed to leave the seat.
}
TUIRoomEngine.sharedInstance().leaveSeat(new TUIRoomDefine.ActionCallback() {
@Override
public void onSuccess() {
// Successfully became a listener.
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
// Failed to become a speaker.
}
});

Moving Seat

When you are already in the seat, you can call the moveToSeat API to implement the move seat feature. Input parameter: the index of the seat you want to move to.
Take moving to Seat 2 as an example:
iOS
Android
import RTCRoomEngine

let targetIndex = 2
TUIRoomEngine.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() {
@Override
public void onSuccess() {
// Successfully moved the seat.
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
// Failed to move the seat.
}
});

Remove a speaker.

When you are the room owner, you can implement this feature by calling the kickUserOffSeatByAdmin API, with the incoming parameter: the user Id of the user to be removed.
Take the user with seat user Id 100001 as an example:
iOS
Android
import RTCRoomEngine

let 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, messagae 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() {
@Override
public void onSuccess() {
// Successfully remove a speaker.
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
// Failed to remove a speaker.
}
});

Invitation to Speak

When you are the room owner, you can perform this operation by calling the 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.
Take inviting the user with user Id 100002 to speak for seat No.4 as an example:
iOS
Android
import RTCRoomEngine

let targetIndex = 4
let 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 anchor you want to kick off the mic.
TUIRoomEngine.sharedInstance().takeUserOnSeatByAdmin(tartgetIndex,
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 timed out
} onTimeout: { requestId, userId in
// Seat-taking invitation canceled
} 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 anchor you want to kick off the mic.
TUIRoomEngine.sharedInstance().takeUserOnSeatByAdmin(targetIndex, targetUserId, timeout, new TUIRoomDefine.RequestCallback() {
@Override
public void onAccepted(String requestId, String userId) {
// Seat-taking invitation accepted
}
@Override
public void onRejected(String requestId, String userId, String message) {
// Seat-taking invitation rejected
}
@Override
public void onCancelled(String requestId, String userId) {
// Seat-taking invitation timed out
}
@Override
public void onTimeout(String requestId, String userId) {
// Seat-taking invitation canceled
}
@Override
public void onError(String requestId, String userId, TUICommonDefine.Error error, String message) {
// Seat-taking invitation exception
}
});
If you become an observer of the 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.
iOS
Android
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() {
@Override
public void onSuccess() {
// Handle seat invitation successfully
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
// Handle seat invitation failure
}
});
}
}

Locking a Seat

iOS
Android
When you are the room owner and want to lock seat No. 5 to prevent others from becoming a speaker, or want to mute the anchor on seat No. 6 and block the video of the anchor on seat No. 7, you can call the lockSeat API, passing in two parameters: the index of the seat to be locked and the lock mode.
The structure of 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
false
lockAudio
Lock the seat microphone.
Locking the corresponding seat camera will stop the audio stream from that seat.
Boolean value
true when the seat microphone is locked.
When you are the room owner and want to lock seat No. 5 to prevent others from becoming a speaker, or want to mute the anchor on seat No. 6 and block the video of the anchor on seat No. 7, you can call the lockSeat API, passing in two parameters: the index of the seat to be locked and the lock mode.
The structure of 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
false
lockAudio
Lock the seat microphone.
Locking the corresponding seat camera will stop the audio stream from that seat.
Boolean value
true when the seat microphone is locked.
You can achieve the above features by calling the lockSeatByAdmin API.
iOS
Android
import RTCRoomEngine

// Lock a seat.
let lockSeatIndex = 5
let lockSeatParam = TUISeatLockParams()
lockSeatParam.lockSeat = true
TUIRoomEngine.sharedInstance().lockSeatByAdmin(lockSeatIndex,
lockMode: lockSeatParam) {
// Successfully lock the seat.
} onError: { code, message in
// Failed to lock the seat.
}

// Lock the seat microphone.
let lockSeatAudioIndex = 6
let lockSeatAudioParam = TUISeatLockParams()
lockSeatAudioParam.lockAudio = true
TUIRoomEngine.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 = 7
let lockSeatVideoParam = TUISeatLockParams()
lockSeatAudioParam.lockVideo = true
TUIRoomEngine.sharedInstance().lockSeatByAdmin(lockSeatVideoIndex,
lockMode: lockSeatAudioParam) {
// 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() {
@Override
public void onSuccess() {
// Successfully lock the seat.
}
@Override
public 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() {
@Override
public void onSuccess() {
// Successfully lock the seat microphone.
}
@Override
public 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();
lockSeatAudioParam.lockVideo = true;
TUIRoomEngine.sharedInstance().lockSeatByAdmin(lockSeatVideoIndex, lockSeatAudioParam, new TUIRoomDefine.ActionCallback() {
@Override
public void onSuccess() {
// Lock seat camera successfully
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
// Lock seat camera failed.
}
});

Listening Callback

iOS
Android
You can become an observer of the RTC Room Engine SDK by calling addObserver to listen to seat-related callbacks.
Take CoGuestController becoming an observer as an example:
import RTCRoomEngine

class 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 changes
func onRoomSeatModeChanged(roomId: String, seatMode: TUISeatMode) {
// The seat mode of the room has changed. Current mode: seatMode
}
// Triggered when the seat position list changes
func 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' requests
func onRequestReceived(request: TUIRequest) {
switch request.requestAction {
case .takeSeat:
// Received a request to speak from request.userName
case .remoteUserOnSeat:
// Received a Microphone Invitation from request.userName
default:
break
}
}
// Triggered when other users cancel the request
func 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 owner
func 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
}
}
}
You can become an observer of the RTC Room Engine SDK by calling addObserver to listen to seat-related callbacks.
Take 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
@Override
public 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
@Override
public 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
@Override
public void onRequestReceived(TUIRoomDefine.Request request) {
switch (request.requestAction) {
case REQUEST_TO_TAKE_SEAT:
// Received a request to speak from request.userName
case REQUEST_REMOTE_USER_ON_SEAT:
// Received a Microphone Invitation from request.userName
default:
break;
}
}
// Triggered when other users cancel the request
@Override
public 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
@Override
public 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;
}
}
}