Audience Connection
Description of the Feature
The 'audience mic link' feature is a real-time interactive communication method. By using the audience mic link feature, hosts can interact in real time with up to 9 audience members, whether it's answering questions, sharing experiences, or engaging in entertainment interactions, all of which significantly enhance the audience's engagement and satisfaction. This direct interaction and communication provide a more convenient and efficient channel for commercial operations and also offer the audience a more personalized and customized shopping experience. The audience mic link feature is suitable for multiple scenarios, including e-commerce live streaming, entertainment live streaming, and online teaching.
Dual-person Mic Connection | Group Mic Connection |
| |
Access Process
Audience mic connection process
The TUILiveKit audience mic connection feature is mainly implemented through LiveCoreView. You can call the following API functions to implement the audience mic connection feature. As an example, Audience B requests to connect with Anchor A as follows.
Note:
The following are active call methods provided by LiveCoreView.
All callback methods refer to the callback methods in the ConnectionObserver object set by LiveCoreView.
Audience sends a mic connection request
Audience B sends a mic connection request to Anchor A. Anchor A will receive the mic connection request from Audience B in the onUserConnectionRequest callback.
let timeout = 60// When initiating a mic connection request, the userId can be an empty stringliveCoreView.requestIntraRoomConnection(userId: "", timeOut: timeOut, openCamera: true) {} onError: { code, message in}
The anchor receives the mic connection request
Anchor A will receive Audience B's mic connection request in the onUserConnectionRequest callback method.
func onUserConnectionRequest(inviterUser: TUIUserInfo) {print("Received audience connection request:\(inviterUser.userId)")}
Anchor responds to the mic connection request
After Anchor A receives Audience B's mic connection request, they can call respondIntraRoomConnection to respond to Audience B on whether the mic connection is accepted.
// Anchor agrees to mic connectionliveCoreView.respondIntraRoomConnection(userId: audienceBUserId, isAccepted: true) {} onError: { code, message in}
The audience receives the anchor's response callback
After Anchor A agrees to the co-broadcast request from Audience B, Audience B will receive Anchor A's agreement to co-broadcast through the onUserConnectionAccepted callback.
func onUserConnectionAccepted(userId: String) {print("Audience agrees to connect:\(inviterUser.userId)")}
Callback for changes in the list of co-broadcasting users
After Host A agrees to the co-broadcast request from Audience B, LiveCoreView will send notifications to both Host A and Audience B about the changes in co-broadcasting users.
func onConnectedUsersUpdated(userList: [TUIUserInfo], joinList: [TUIUserInfo], leaveList: [TUIUserInfo]) {print("Callback for changes in the list of co-broadcasting user")}
Process of disconnecting audio connection
After the audience successfully connects, the host hangs up the mic connection
After Audience B and Host A successfully connect, Host A disconnects the mic connection with Audience.
let userId = "audienceBUserId"liveCoreView.disconnectUser(userId: userId) {} onError: { code, message in}
The audience receives a callback when the host disconnects the interactive connection.
After Host A disconnects the mic connection with Audience B, Audience B will receive the onUserConnectionTerminated callback.
func onUserConnectionTerminated() {print("Anchor closes connection")}
After the audience successfully connects, the audience ends the mic connection
After Audience B successfully connects with Anchor A, Audience B can actively disconnect by calling terminateIntraRoomConnection.
liveCoreView.terminateIntraRoomConnection()
The host receives a callback when an audience member disconnects.
When Audience B actively disconnects the mic, the anchor will receive the onUserConnectionExited callback.
func onUserConnectionExited(userInfo: TUIUserInfo) {print("Audience exits the connection")}
Note:
The connection feature is implemented based on LiveCoreView. If you need to extend the connection feature, please refer to the LiveCoreView documentation.
Mic Connection Sequence Diagram