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

Room List

this document primarily introduces how to use RTC Room Engine SDK to implement the room list function.
You can leverage the TUILiveListManager plugin provided by the RTC Room Engine SDK to implement the room list function.
When using the TUILiveListManager plug-in, you only need to focus on how to make your live streaming room visible in the room list and how to obtain the live room list.

Prerequisites

Before using the RTC RoomEngine SDK, you need to call log in to the SDK first so that subsequent features can be used normally.

User Guide

How to Make Your Live Streaming Room Visible in the Room List

First, you need to obtain the TUILiveListManager plug-in through the getExtension API.
Then reuse the setLiveInfo API of the TUILiveListManager plug-in to implement the feature, importing two parameters: live room information and Modification Flag.
iOS
Android
import RTCRoomEngine

let liveListManager = TUIRoomEngine.sharedInstance().getExtension(extensionType: .liveListManager) as! TUILiveListManager

let liveInfo = TUILiveInfo()
liveInfo.roomInfo.roomId = "live_100001" //Please replace it with your own live streaming room ID.
liveInfo.isPublicVisible = true //Make the live streaming room displayed in the list
liveListManager.setLiveInfo(liveInfo, modifyFlag: [.publish]) {
// Successfully set live room information
} onError: { code, message in
// Fail to set live room information
}
TUILiveListManager liveListManager = (TUILiveListManager) TUIRoomEngine.sharedInstance().getExtension(TUICommonDefine.ExtensionType.LIVE_LIST_MANAGER);

TUILiveListManager.LiveInfo liveInfo = new TUILiveListManager.LiveInfo();
liveInfo.roomInfo.roomId = "live_100001"; //Please replace it with your own live streaming room ID.
liveInfo.isPublicVisible = true;
List<TUILiveListManager.LiveModifyFlag> flagList = new ArrayList<>();
flagList.add(TUILiveListManager.LiveModifyFlag.PUBLISH);
liveListManager.setLiveInfo(liveInfo, flagList, new TUIRoomDefine.ActionCallback() {
@Override
public void onSuccess() {
// Successfully set live room information
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
// Fail to set live room information
}
});
Note:
Before setting the live streaming room to be visible, make sure that your live streaming room is in live streaming status.

How to Obtain the Live Room List

First, you need to obtain the TUILiveListManager plug-in through the getExtension API.
Then reuse the fetchLiveList API of the TUILiveListManager plug-in to implement the feature, importing two parameters: list index of string type and the count of live rooms pulled at a time.
iOS
Android
import RTCRoomEngine

let liveListManager = TUIRoomEngine.sharedInstance().getExtension(extensionType: .liveListManager) as! TUILiveListManager

let cursor = "" // For the first pull, just fill in an empty string for the index. For subsequent pulls, set the value according to the cursor returned by the API.
let singleFetchRoomLimit = 50 // Replace it with the number of live rooms you want to pull at a time. The upper limit of the number is 50.
liveListManager.fetchLiveList(cursor: "", count: singleFetchRoomLimit) { cursor, liveList in
// Successfully retrieved live room list
} onError: { code, message in
// Failed to retrieve live room list
}
TUILiveListManager liveListManager = (TUILiveListManager) TUIRoomEngine.sharedInstance().getExtension(TUICommonDefine.ExtensionType.LIVE_LIST_MANAGER);

String cursor = ""; // For the first pull, just fill in an empty string for the index. For subsequent pulls, set the value according to the cursor returned by the API.
int singleFetchRoomLimit = 50; // Replace it with the number of live rooms you want to pull at a time. The upper limit of the number is 50.
liveListManager.fetchLiveList("", singleFetchRoomLimit, new TUILiveListManager.LiveInfoListCallback() {
@Override
public void onSuccess(TUILiveListManager.LiveInfoListResult result) {
// Successfully retrieved live room list
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
// Failed to retrieve live room list
}
});