Live Stream List
TUILiveKit’s Live Stream List feature is powered by LiveListView, which displays multiple live rooms in a vertically paginated feed. Audiences can easily swipe up or down to switch between rooms, making integration straightforward for your application.
Feature Overview
Live Room Feed: Shows multiple live rooms in a vertically paginated container. Each page provides a complete viewing interface.
Swipe Up/Down to Switch: Audiences can swipe up or down to move to the previous or next live room. Playback and Enter Room states are automatically handled by the component.
First Screen Pinning: The liveID provided during initialization is pinned to the top of the list. When entering from a shared link or push notification, the target live room appears on the first screen.
Paginated Loading: Before reaching the end of the list, onLoadMore is triggered automatically. Connect to LiveListStore or your backend service to append the next page of data.
Live Room Switching | Live Viewing |
|
|
Component Description
LiveListView is a subclass of UIView that provides a vertically paginated feed of live rooms, implemented internally using a vertical UICollectionView. Each page is managed by a PlayerView, so all playback features for a single live room—including stream pulling, Enter Room, audience co-hosting, live comments, gifts, and likes—are fully aligned with the Audience Viewing documentation.
Note:
LiveListView uses ViewPager2 and FragmentStateAdapter internally. The Activity hosting LiveListView must inherit from FragmentActivity (recommended: AppCompatActivity). Otherwise, a type cast exception will occur during construction.
Quick Integration
Step 1. Activate the Service
Refer to the Activate Service document to get the
TUILiveKit trial version or activate the paid version.Step 2. Integrate the SDK
Step 3. Integrate LiveListView for Swiping Between Live Rooms
Create LiveListView in your Live Stream List viewing Activity and inject the live room list data:
import AtomicXCoreimport SnapKitimport TUILiveKitimport UIKitclass AudienceLiveListViewController: UIViewController {private let liveListView: LiveListViewprivate let pageSize = 6private var isLoading = falseinit(liveID: String = "") {// 1. Create LiveListView; the passed liveID will be the first live room displayedliveListView = LiveListView(liveID: liveID)super.init(nibName: nil, bundle: nil)}@available(*, unavailable)required init?(coder: NSCoder) {fatalError("init(coder:) has not been implemented")}override func loadView() {// 2. Set LiveListView as the controller's root viewview = liveListView}override func viewDidLoad() {super.viewDidLoad()// 3. Set the load more callback, triggered when the audience swipes near the end of the listliveListView.onLoadMore = { [weak self] inself?.loadMore()}// 4. Fetch the initial live room list and set it to LiveListViewrefresh()}private func refresh() {guard !isLoading else { return }fetch(cursor: "") { [weak self] inself?.liveListView.setData(LiveListStore.shared.state.value.liveList)}}private func loadMore() {guard !isLoading else { return }let cursor = LiveListStore.shared.state.value.liveListCursorguard !cursor.isEmpty else { return }let oldCount = LiveListStore.shared.state.value.liveList.countfetch(cursor: cursor) { [weak self] inlet list = LiveListStore.shared.state.value.liveListguard list.count > oldCount else { return }self?.liveListView.appendData(Array(list[oldCount..<list.count]))}}private func fetch(cursor: String, completion: @escaping () -> Void) {isLoading = trueLiveListStore.shared.fetchLiveList(cursor: cursor, count: pageSize) { [weak self] result inDispatchQueue.main.async {self?.isLoading = falseswitch result {case .success:completion()case .failure(let error):print("fetchLiveList failed:\(error.localizedDescription)")}}}}}
Note:
LiveListView is only responsible for rendering, not for fetching data. The live room list can come from AtomicXCore’s LiveListStore or your backend, and should be injected via setData or appendData.
The liveID passed during initialization is pinned to the top of the list, ensuring the audience sees the target live room first.
When the audience swipes to within two live rooms of the end of the list, onLoadMore is triggered. Append the next page of data at this point.
When LiveListView is removed from the window, it automatically stops playback and exits the live room. You do not need to manually call stopPlay or leaveChannel.
When the audience is in co-hosting mode, the component automatically disables swipe switching to prevent accidental interruption. Swipe switching is restored after co-hosting ends.
4. Navigate to the Live Stream List Page
To navigate to the Live Stream List viewing page, use the following code example:
// Jump to the "Swipe to Switch Live Room" viewing pagelet liveListVC = AudienceLiveListViewController(liveID: "Your live room id")liveListVC.modalPresentationStyle = .fullScreenpresent(liveListVC, animated: false)
API Reference
LiveListView
LiveListView is a subclass of UIView that provides a vertically paginated live room feed container.
Method / Property | Description |
init(liveID: String = "") | Constructor. The liveID is displayed as the first live room (pinned to the top of the list). If not provided, the first item in the list is shown. |
setData(_ list: [LiveInfo]) | Sets the live room list data. LiveIDs are deduplicated internally, and the liveID passed in the constructor is pinned to the top. |
appendData(_ list: [LiveInfo]) | Appends live room data to the end of the list for paginated loading. Existing live rooms are updated, not inserted repeatedly. |
onLoadMore | Closure callback, triggered when the audience swipes to within two live rooms of the end of the list. Use this to load the next page of data. |
Live Room List Data
The component does not fetch the list itself. The list is provided by AtomicXCore’s LiveListStore:
Capability | API |
Fetch List | LiveListStore.shared.fetchLiveList(cursor:count:completion:) |
List Data | LiveListStore.shared.state.value.liveList |
Pagination Cursor | LiveListStore.shared.state.value.liveListCursor (empty means no more data) |
Next Steps
You have successfully integrated audience viewing. Next, you can implement host streaming, audience viewing, and other features. See the table below:
Feature | Description | Integration Guide |
Audience Viewing | Use PlayerView to watch a single live room, including stream pulling, Enter Room, and interactive features. | |
Host Streaming | Full host streaming workflow, including pre-stream preparation and post-stream interactions. | |
Gift System | Implement custom gift asset configuration, billing system integration, PK scenario interaction, and more. |
FAQs
Why is there no sound in the live room after the app goes to the background?
Check whether the host app has declared audio background mode:
Target → Signing & Capabilities → Background Modes → select Audio, AirPlay, and Picture in Picture. If not declared, iOS will suspend the audio session when the app enters the background.The list is still empty after calling setData?
Please confirm:
You have called setData() to inject data, and the liveIDs in the list are not empty.
AtomicXCore login is completed, and the fetchLiveList callback returns .success.
If the list data comes from your backend, it has been converted to LiveInfo objects.
LiveListView does not fetch the list itself.
Can audiences swipe up/down to switch live rooms while co-hosting?
No. After the audience enters the CO_GUEST state, the component automatically disables swipe switching to prevent accidental interruption of co-hosting. Swipe switching is restored after co-hosting ends.
