Audience Connection
Description of the Feature
The co-mic feature for audiences is a real-time interactive communication method. Through the co-mic feature, a host can interact in real time with up to 9 audience members, whether it's answering questions, sharing experiences, or engaging in entertainment interactions, greatly enhancing the audience's sense of participation and satisfaction. This direct interaction and communication provide a more convenient and efficient channel for commercial operations, while also offering audiences a more personalized and customized shopping experience. The audience co-mic feature is suitable for multiple scenarios, including e-commerce live streaming, entertainment live streaming, and online teaching etc.
Single-person co-mic | Multi-person co-mic |
| |
Use Instructions
Audience initiates join microphone application.
Click the co-mic request button | Choose the way to connect the microphone | Send a connection request and wait for the host to agree | After the host agrees, the connection is successful |
| | | |
The host handles the audience's mic connection requests.
Received the audience's connection request | Click on the connected mic user to open the connection dashboard | After clicking agree, the connection is successful |
| | |
feature customization
Self Definition Host end mic connection management panel view
If you need the Self Definition Host end mic connection management panel view, please refer to the following path for changes.
// File Location:tuilivekit/src/main/java/
com/trtc/uikit/livekit/view/liveroom/view/anchor/livestreaming/link // Host mic connection related view directory├── AnchorApplyLinkMicAdapter.java // Adapter for the list of users applying for mic connection├── AnchorLinkMicAdapter.java // Adapter for the list of users with successful mic connections└── AnchorLinkMicManagePanel.java // Mic connection management panel: can accept audience mic connection, reject audience mic connection, hang up mic connection
Self Definition Audience end mic connection application panel view
If you need the Self Definition Audience end mic connection application panel view, please refer to the following path for changes.
// File Location:tuilivekit/src/main/java/
com/trtc/uikit/livekit/view/liveroom/view/audience/livestreaming/
link // Audience mic connection related view directory├── SelectLinkMicTypePanel.java // View for audience to choose between voice or video mic connection├── VideoLinkSettingsPanel.java // Parameter settings panel view for video mic connection└── VideoSettingsAdapter.java // Adapter for video mic connection parameter settings
Key code
Mic Connect
The TUILiveKit audience mic connection feature is mainly implemented through LiveService. In LiveService, you can obtain the TUIRoomEngine object through
createEngine()
, and then call the related API functions to implement the audience mic connection feature. As an example, Audience B requests to connect the mic with Anchor A. The specific interaction sequence can be referred to in the diagram below.
Audience sends a mic connection request
// File Location:TUILiveKit/src/Main/java/com/trtc/uikit/livekit/service/impl/LiveServiceImpl.javamTUIRoomEngine.takeSeat(seatIndex, timeout, new TUIRoomDefine.RequestCallback() { @Override public void onAccepted(String requestId, String userId) { // Host agrees to mic request callback } @Override public void onRejected(String requestId, String userId, String message) { // Host rejects mic request callback } @Override public void onCancelled(String requestId, String userId) { // Audience cancels mic request callback } @Override public void onTimeout(String requestId, String userId) { // Audience mic request timeout callback } @Override public void onError(String requestId, String userId, TUICommonDefine.Error error, String message) { // Mic request sends failure callback } });
The anchor receives the mic connection request
// File Location:TUILiveKit/src/Main/java/com/trtc/uikit/livekit/manager/observer/RoomEngineObserver.java@Override public void onRequestReceived(TUIRoomDefine.Request request) { LiveKitLog.info(mTag + " onRequestReceived:[request:" + new Gson().toJson(request) + "]"); mLiveController.getSeatController().onRequestReceived(request); }
Audience cancels mic request
// File Location:TUILiveKit/src/Main/java/com/trtc/uikit/livekit/service/impl/LiveServiceImpl.javamTUIRoomEngine.cancelRequest(requestId, new TUIRoomDefine.ActionCallback() { @Override public void onSuccess() {} @Override public void onError(TUICommonDefine.Error error, String message) {} });
Host end received mic request cancellation
// File Location:TUILiveKit/src/Main/java/com/trtc/uikit/livekit/manager/observer/RoomEngineObserver.javapublic void onRequestCancelled(TUIRoomDefine.Request request, TUIRoomDefine.UserInfo operateUser) { LiveKitLog.info(mTag + " onRequestCancelled:[request:" + request + ",operateUser:" + operateUser + "]"); mLiveController.getSeatController().onRequestCancelled(request, operateUser); }
Host handles mic request
// File Location:TUILiveKit/src/Main/java/com/trtc/uikit/livekit/service/impl/LiveServiceImpl.javamTUIRoomEngine.responseRemoteRequest(requestId, true, new TUIRoomDefine.ActionCallback() { @Override public void onSuccess() {} @Override public void onError(TUICommonDefine.Error error, String message) {} });
After the audience successfully connects their mic, the host hangs up the mic connection
// File Location:TUILiveKit/src/Main/java/com/trtc/uikit/livekit/service/impl/LiveServiceImpl.javamLiveService.kickUserOffSeatByAdmin(0, userId, new TUIRoomDefine.ActionCallback() { @Override public void onSuccess() {} @Override public void onError(TUICommonDefine.Error error, String message) {} });
After the audience successfully connects their mic, the audience ends the mic connection
// File Location:TUILiveKit/src/Main/java/com/trtc/uikit/livekit/service/impl/LiveServiceImpl.javamLiveService.leaveSeat(new TUIRoomDefine.ActionCallback() { @Override public void onSuccess() {} @Override public void onError(TUICommonDefine.Error error, String message) {} });
- Description of the Feature
- Use Instructions
- feature customization
- Key code
- Mic Connect
- Audience sends a mic connection request
- The anchor receives the mic connection request
- Audience cancels mic request
- Host end received mic request cancellation
- Host handles mic request
- After the audience successfully connects their mic, the host hangs up the mic connection
- After the audience successfully connects their mic, the audience ends the mic connection