This document mainly introduces how to use the RTC Room Engine
SDK to implement the room list feature.
You can use the RTC Room Engine
SDK provided TUILiveListManager
plugin to implement the room list feature.
When using the TUILiveListManager plugin, you only need to focus on how to make your live streaming room visible in the room list and how to get the live streaming room list.
Prerequisites
Before using the RTC RoomEngine
SDK, you need to call the SDK login to ensure the subsequent features work properly. User Guide
Making Your Live Streaming Room Visible in the Room List
You first need to get the TUILiveListManager
plugin through the getExtension
API.
Then use the TUILiveListManager
plugin's setLiveInfo
API to implement this feature, passing in two parameters: live room information and modification identifier.
import RTCRoomEngine
let liveListManager = TUIRoomEngine.sharedInstance().getExtension(extensionType: .liveListManager) as! TUILiveListManager
let liveInfo = TUILiveInfo()
liveInfo.roomInfo.roomId = "live_100001"
liveInfo.isPublicVisible = true
liveListManager.setLiveInfo(liveInfo, modifyFlag: [.publish]) {
} onError: { code, message in
}
TUILiveListManager liveListManager = (TUILiveListManager) TUIRoomEngine.sharedInstance().getExtension(TUICommonDefine.ExtensionType.LIVE_LIST_MANAGER);
TUILiveListManager.LiveInfo liveInfo = new TUILiveListManager.LiveInfo();
liveInfo.roomInfo.roomId = "live_100001";
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() {
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
}
});
Note:
Before setting the live room to visible, please ensure your live room is in the live streaming state.
How to Get the Live Room List
You first need to get the TUILiveListManager
plugin through the getExtension
API.
Then use the TUILiveListManager
plugin's fetchLiveList
API to implement this feature, passing in two parameters: a string type list index and the number of live rooms to fetch in a single request.
import RTCRoomEngine
let liveListManager = TUIRoomEngine.sharedInstance().getExtension(extensionType: .liveListManager) as! TUILiveListManager
let cursor = ""
let singleFetchRoomLimit = 50
liveListManager.fetchLiveList(cursor: "", count: singleFetchRoomLimit) { cursor, liveList in
} onError: { code, message in
}
TUILiveListManager liveListManager = (TUILiveListManager) TUIRoomEngine.sharedInstance().getExtension(TUICommonDefine.ExtensionType.LIVE_LIST_MANAGER);
String cursor = "";
int singleFetchRoomLimit = 50;
liveListManager.fetchLiveList("", singleFetchRoomLimit, new TUILiveListManager.LiveInfoListCallback() {
@Override
public void onSuccess(TUILiveListManager.LiveInfoListResult result) {
}
@Override
public void onError(TUICommonDefine.Error error, String message) {
}
});
Was this page helpful?