このページは現在英語版のみで提供されており、日本語版も近日中に提供される予定です。ご利用いただきありがとうございます。

アンカー接続

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 anchor connection feature is mainly implemented based on LiveCoreView. You can use the following API to complete the anchor connection feature. Here is an example of connection between Anchor A and Anchor B.
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.

Anchor A initiates the connection

Anchor A initiates the connection by calling requestCrossRoomConnection and passing the room ID of anchor B in the roomId parameter.
Android
iOS
Kotlin
java
val roomId = "anchorBRoomId"
mLiveViewList.requestCrossRoomConnection(roomId, 10, null)
String roomId = "anchorBRoomId";
mLiveViewList.requestCrossRoomConnection(roomId, 10, null);
Swift
OC
let roomId = "anchorRoomId"

liveCoreView.requestCrossRoomConnection(roomId: roomId, timeOut: 60) {
} onError: { code, message in
}
NSString *roomId = @"anchorRoomId";

[liveCoreView requestCrossRoomConnection:roomId
timeOut:60
onSuccess:^(void) {
} onError:^(NSInteger code, NSString * _Nonnull message) {
}];
Anchor A can receive the request acceptance callback through onCrossRoomConnectionAccepted.

Anchor B receives the connection request

Anchor B receives the connection request callback through onCrossRoomConnectionRequest.
Android
iOS
Kotlin
java
override fun onCrossRoomConnectionRequest(inviterUser: UserInfo) {
Log.i(TAG, "Received a connection request from anchor A's room:${inviterUser.userId}")
}
@Override
public void onCrossRoomConnectionRequest(LiveStreamDefine.RoomInfo roomInfo) {
Log.i(TAG, "Received a connection request from anchor A's room:" + roomInfo.roomId);
}
Swift
OC
func onCrossRoomConnectionRequest(hostUser: TUIConnectionUser) {
print("Received a connection request from anchor A's room:\(hostUser.userId)")
}
- (void)onCrossRoomConnectionRequest:(TUIConnectionUser *)hostUser {
NSLog(@"Received a connection request from anchor A's room:%@", hostUser.userId);
}
Anchor B responds to the connection request by calling respondToCrossRoomConnection.
Android
iOS
Kotlin
java
liveCoreView.respondToCrossRoomConnection(roomId, true, null)
liveCoreView.respondToCrossRoomConnection(roomId, true, null);
Swift
OC
liveCoreView.respondToCrossRoomConnection(roomId: roomId, isAccepted: true) {
} onError: { code, message in
}
[liveCoreView respondToCrossRoomConnection:roomId
isAccepted:true
onSuccess:^(void) {
} onError:^(NSInteger code, NSString * _Nonnull message) {
}];
Anchor A, anchor B, and the audience in the room receive the onConnectedRoomsUpdated callback and get notified of the changes in the connection list.
Android
iOS
Kotlin
java
override fun onConnectedRoomsUpdated(inviterUser: UserInfo) {
Log.i(TAG, "The anchor connection room list has been updated")
}
@Override
public void onConnectedRoomsUpdated(List<LiveStreamDefine.RoomInfo> roomList) {
Log.i(TAG, "The anchor connection room list has been updated");
}
Swift
OC
func onConnectedRoomsUpdated(hostUserList: [TUIConnectionUser]) {
print("The anchor connection room list has been updated")
}
- (void)onConnectedRoomsUpdated:(NSArray<TUIConnectionUser *> *)hostUserList {
NSLog(@"The anchor connection room list has been updated");
}

Exit connection process

Anchor B exits the connection by calling terminateCrossRoomConnection
Android
iOS
kotlin
java
public void disconnect(TUIRoomDefine.ActionCallback callback) {
mTUILiveConnectionManager.disconnect(callback);
}
liveCoreView.terminateIntraRoomConnection()
Swift
OC
liveCoreView.terminateCrossRoomConnection()
[liveCoreView terminateCrossRoomConnection];
Note:
The connection feature is implemented based on LiveCoreView. If you need to extend the connection feature, please refer to the LiveCoreView documentation.

Anchor connection sequence diagram