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

Audience Viewing Page

Feature Overview

The audience viewing page refers to the page where viewers enter the host's live streaming room to watch the live stream, enabling features such as audience co-broadcasting, live room information, online audience display, gift display, likes, and bullet screen. This document describes how to complete the access work for the audience viewing page within 10 minutes.
watch live
audience co-broadcasting








Feature Integration

Note:
Note: Before completing the feature integration, you must first complete the integration steps in the overview.

Creating an Audience Viewing Page Stream View (This Step Can Be Placed in Your Own ViewController)

Swift
let audienceContainerView = AudienceContainerView(roomId: "yourRoomId")

Load the Audience Viewing Page Stream View Into ViewController

Swift
view.addSubView(audienceContainerView)
audienceContainerView.snp.remakeConstraints { make in
make.edges.equalToSuperview()
}

Listen to the Audience Viewing Page Event Callback

Swift
audienceContainerView.delegate = self

// Implement AudienceContainerViewDelegate in your own ViewController
extension YourViewController: AudienceContainerViewDelegate {
//Room owner ended live stream callback
func onLiveEnded(roomId: String, avatarUrl: String, userName: String) {
let audienceEndView = AudienceEndStatisticsView(roomId: roomId, avatarUrl: avatarUrl, userName: userName)
audienceEndView.delegate = self
view.addSubview(audienceEndView)
audienceEndView.snp.remakeConstraints { make in
make.edges.equalToSuperview()
}
}

//Click the floating window button callback
func onClickFloatWindow() {
FloatWindow.shared.showFloatWindow(controller: self, provider: audienceContainerView)
}
}

Feature Customization

Hide Room Information in Top Operation Section

Swift
audienceContainerView.disableHeaderLiveData(true)

Hide Audience List Feature in Top Operation Section

Swift
audienceContainerView.disableHeaderVisitorCnt(true)

Hide the Co-Anchoring Function in the Bottom Operation Section

Swift
audienceContainerView.disableFooterCoGuest(true)

Hide Floating Window Feature

Swift
audienceContainerView.disableHeaderFloatWin(true)

Forbid Swiping during Live Stream

Swift
audienceContainerView.disableSliding(true)

Implement Custom Data Source for Audience Viewing

The audience viewing component uses RoomEngine live stream list data by default. If your backend has a separate backend live list, you can integrate it via the following way:
Swift
audienceContainerView.dataSource = self

// Implement AudienceContainerViewDataSource in your own ViewController

extension YourViewController: AudienceContainerViewDataSource {
func fetchLiveList(cursor: String, onSuccess: @escaping LiveListSuccessBlock, onError: @escaping LiveListErrorBlock) {
// Connect to your own business backend and return data to the UI component in the following format
var liveInfoList: [LiveInfo] = []
var liveInfo = LiveInfo()
liveInfo.roomId = "live_123456"
liveInfo.name = "live_123456"
liveInfoList.append(liveInfo)
let cursor = "aabbccdd"
onSuccess(cursor, liveInfoList)
}
}