Description of the Feature
The connection feature is a real-time interactive communication method, customized for anchors. It enables anchors from different rooms to interact and communicate in real-time during the livestream. TUILiveKit's connection feature supports up to nine people in a single room simultaneously. It provides strong technical support for various scenarios such as anchor interaction, knowledge sharing, cultural exchange, and e-commerce training. It offers diverse interactive methods for anchors and enriches the viewing experience for the audience, creating more surprises and value for both parties, and making livestreams more attractive.
Two-person connection | Multiple people connection |
| |
Access Process
Anchor Connection Process
The TUILiveKit connection feature for anchors is mainly implemented based on LiveCoreView. You can complete the anchor connection feature using the following API. Here is an example of connecting Anchor A with Anchor B.
Note:
The methods described below are actively invoked and provided by LiveCoreView.
All callback methods refer to the callback methods in the ConnectionObserver object set by LiveCoreView.
Anchor A initiates the connection
Anchor A initiates the connection by calling requestCrossRoomConnection and passing the room id of the anchor B in the roomId parameter.
val roomId = "anchorBRoomId"
mLiveViewList.requestCrossRoomConnection(roomId, 10, null)
String roomId = "anchorBRoomId";
mLiveViewList.requestCrossRoomConnection(roomId, 10, null);
Anchor A can receive the acceptance callback via onCrossRoomConnectionAccepted.
Anchor B receives the connection request
Anchor B receives the connection request callback via onCrossRoomConnectionRequest.
override fun onCrossRoomConnectionRequest(inviterUser: UserInfo) {
Log.i(TAG, "Received connection request from anchor A's room: ${inviterUser.userId}")
}
@Override
public void onCrossRoomConnectionRequest(LiveStreamDefine.RoomInfo roomInfo) {
Log.i(TAG, "Received connection request from anchor A's room: " + roomInfo.roomId);
}
Anchor B responds to the connection request by calling respondToCrossRoomConnection.
liveCoreView.respondToCrossRoomConnection(roomId, true, null)
liveCoreView.respondToCrossRoomConnection(roomId, true, null);
Anchor A, B, and the audience in the room receive the onConnectedRoomsUpdated callback and are notified of changes in the connection list.
override fun onConnectedRoomsUpdated(inviterUser: UserInfo) {
Log.i(TAG, "Anchor connection room list updated")
}
@Override
public void onConnectedRoomsUpdated(List<LiveStreamDefine.RoomInfo> roomList) {
Log.i(TAG, "Host connection room list updated");
}
Exit connection process
Anchor B calls terminateIntraRoomConnection to exit the connection.
public void disconnect(TUIRoomDefine.ActionCallback callback) {
mTUILiveConnectionManager.disconnect(callback);
}
liveCoreView.terminateIntraRoomConnection()
Anchor A, B, and the audience in the room receive the onConnectedRoomsUpdated callback and are notified of changes in the connection list.
override fun onConnectedRoomsUpdated(inviterUser: UserInfo) {
Log.i(TAG, "Anchor connection room list updated")
}
@Override
public void onConnectedRoomsUpdated(List<RoomInfo> roomList) {
Log.i(TAG, "Anchor connection room list updated");
}
Note:
The connection feature is implemented based on LiveCoreView. If you need to extend the connection feature, please refer to LiveCoreView documentation. Anchor Connection Sequence Diagram
Was this page helpful?