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:Flutter/lib/widget/live_room/anchor/live_streaming/link/link // Host mic connection related view directory├── anchor_link_mic_manage_panel_widget.dart // Mic connection management panel: Accept audience mic connection, Reject audience mic connection, Hang up mic connection└── apply_link_mic_float_widget.dart // When an audience applies for mic connection, the floating prompt mic connection view at the top level
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:Flutter/lib/widget/live_room/audience/component/live_streaming/link/
link // Audience mic connection related view directory├── select_link_mic_type_panel_widget.dart // Audience mic connection pop-up view to choose between voice or video mic connection└── video_link_settings_panel_widget.dart // Video mic connection settings panel view
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:Flutter/lib/service/impl/room_engine_service.dart@overrideTUIRequest takeSeat(int seatIndex, int timeout, TUIRequestCallback? requestCallback) {return roomEngine.takeSeat(seatIndex, timeout, requestCallback);}
The anchor receives the mic connection request
// File Location:Flutter/lib/manager/observer/live_observer.dartsuper.onRequestReceived = (request) {LiveKitLogger.info("$tag onRequestReceived:[request:$request");liveController.seatController.onRequestReceived(request);};
Audience cancels mic request
// File Location:Flutter/lib/service/impl/room_engine_service.dartmTUIRoomEngine.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:Flutter/lib/manager/observer/live_observer.dartsuper.onRequestCancelled = (requestId, userId) {LiveKitLogger.info("$tag onRequestCancelled:[requestId:$requestId,userId:$userId");liveController.seatController.onRequestCancelled(requestId, userId);};
Host handles mic request
// File Location:Flutter/lib/service/impl/room_engine_service.dartmTUIRoomEngine.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:Flutter/lib/service/impl/room_engine_service.dartmLiveService.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:Flutter/lib/service/impl/room_engine_service.dartmLiveService.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