tencent cloud

Tencent Real-Time Communication

소식 및 공지 사항
제품 업데이트
Tencent Cloud 오디오/비디오 단말 SDK 재생 업그레이드 및 권한 부여 인증 추가
TRTC 월간 구독 패키지 출시 관련 안내
제품 소개
제품 개요
기본 개념
제품 기능
제품 장점
응용 시나리오
성능 데이터
구매 가이드
Billing Overview
무료 시간 안내
Monthly subscription
Pay-as-you-go
TRTC Overdue and Suspension Policy
과금 FAQ
Refund Instructions
신규 사용자 가이드
Demo 체험
Call
개요(TUICallKit)
Activate the Service
Run Demo
빠른 통합(TUICallKit)
오프라인 푸시
Conversational Chat
온클라우드 녹화(TUICallKit)
AI Noise Reduction
UI 사용자 정의
Calls integration to Chat
Additional Features
No UI Integration
Server APIs
Client APIs
Solution
ErrorCode
릴리스 노트
FAQs
라이브 스트리밍
Billing of Video Live Component
Overview
Activating the Service (TUILiveKit)
Demo 실행
No UI Integration
UI Customization
Live Broadcast Monitoring
Video Live Streaming
Voice Chat Room
Advanced Features
Client APIs
Server APIs
Error Codes
Release Notes
FAQs
RTC Engine
Activate Service
SDK 다운로드
API 코드 예시
Usage Guidelines
API 클라이언트 API
고급 기능
RTC RESTFUL API
History
Introduction
API Category
Room Management APIs
Stream mixing and relay APIs
On-cloud recording APIs
Data Monitoring APIs
Pull stream Relay Related interface
Web Record APIs
AI Service APIs
Cloud Slicing APIs
Cloud Moderation APIs
Making API Requests
Call Quality Monitoring APIs
Usage Statistics APIs
Data Types
Appendix
Error Codes
콘솔 가이드
애플리케이션 관리
사용량 통계
모니터링 대시보드
개발 보조
Solution
Real-Time Chorus
FAQs
과금 개요
기능 관련
UserSig 관련
방화벽 제한 처리
설치 패키지 용량 축소 관련 질문
Andriod 및 iOS 관련
Web 관련
Flutter 관련
Electron 관련
TRTCCalling Web 관련
멀티미디어 품질 관련
기타 질문
Protocols and Policies
컴플라이언스 인증
보안 백서
정보 보안에 관한 참고 사항
Service Level Agreement
Apple Privacy Policy: PrivacyInfo.xcprivacy
TRTC 정책
개인 정보 보호 정책
데이터 처리 및 보안 계약
용어집

Audience Viewing (React Native)

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-01-23 11:13:45
This guide walks you through integrating the audience viewing page, enabling users to watch a host’s live stream, join as co-hosts, view live room details, check the online audience, send gifts, like streams, and interact via live comments.

Feature Preview

The audience viewing page includes default behaviors and styles out of the box. If these defaults don’t fully match your requirements, you can customize the UI to fit your needs.


Quick Integration

Step 1: Activate the Service

Refer to the Activate Service document to enable the trial version or activate the Pro Edition package.

Step 2: Integrate the Code

See Preparation for instructions on integrating TUILiveKit.
Make sure your project includes react-native-safe-area-context. If not, install it with:
yarn add react-native-safe-area-context

Step 3: Add an Audience Viewing Page

react-native-tuikit-live provides a complete audience-side UI and business logic for live streaming. To display the audience viewing page, configure the entry point for calling LiveAudiencePage based on your business logic, then follow these steps to navigate to the audience viewing page:
Note:
This example uses useState for a simple page switching. For production apps, it is recommended to use navigation libraries like React Navigation for page management. To understand how to integrate navigation libraries, refer to React Navigation official documentation.

/**
* Simple navigation example - manage page transitions using useState
*/
import React, { useState } from 'react';
import { View, Button, StyleSheet } from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { LiveAudiencePage } from 'react-native-tuikit-live';
import { useLiveListState } from 'react-native-tuikit-atomic-x';

type PageType = 'home' | 'liveAudience' | 'liveEnd';

function MyApp() {

// In real scenarios, liveID is typically sourced from:
// 1. Parameters when entering a live stream from the Live Stream List
// 2. Route parameters
// 3. Server API response
// Here, '1234' is used as an example
const liveID = '1234'
const { joinLive } = useLiveListState(liveID)

const [currentPage, setCurrentPage] = useState<PageType>('home');
const [endedLiveID, setEndedLiveID] = useState<string>('');

// Navigate to the audience viewing page
const handleJumpLiveAudience = async () => {
await joinLive({
liveID,
onSuccess: () => {
setCurrentPage('liveAudience');
},
onError: (error) => {
console.error('Failed to join live room:', error);
// Handle the error, e.g., notify the user
}
})
};

// Return from the audience viewing page
const handleBackFromAudience = () => {
setCurrentPage('home');
};

// End the live stream
const handleEndLive = (liveID?: string) => {
setEndedLiveID(liveID || '');
setCurrentPage('liveEnd');
};

return (
<SafeAreaProvider>
{currentPage === 'home' && (
<View style={styles.container}>
<Button title="Enter Audience View" onPress={handleJumpLiveAudience} />
</View>
)}

{currentPage === 'liveAudience' && (
<LiveAudiencePage
onBack={handleBackFromAudience}
onEndLive={handleEndLive}
/>
)}

{currentPage === 'liveEnd' && (
<View style={styles.container}>
<Button title="Return to Home" onPress={() => setCurrentPage('home')} />
</View>
)}
</SafeAreaProvider>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
});

export default MyApp;

Customize UI Layout

TUILiveKit supports extensive customization of the audience viewing page, so you can tailor features and styles to your business requirements.

Customize Icons

All icons used by TUILiveKit are located in the tuikit-atomic-x/src/static/images directory. Some examples are listed below. To update an icon, simply replace the corresponding file in this directory.
Icon Path
Description
/static/images/dashboard.png
“Dashboard” icon in the bottom action bar
/static/images/link-guest.png
“Apply for co-hosting” icon in the bottom action bar
/static/images/live-gift.png
“Gift” icon in the bottom action bar
/static/images/live-like.png
“Like” icon in the bottom action bar
/static/images/close.png
“Leave live room” icon in the top action bar
After updating the icons, rebuild and run your app to see the changes.

Customize Texts

All UI text in TUILiveKit is managed in a centralized location. To update any text, edit the relevant json files in the tuikit-atomic-x/src/locales/ directory.

zh.json - Chinese text
en.json - English text
After editing, rebuild and run your app to apply the updates.

Add a Button

To add a Like button to the top left of the video area, edit live/src/pages/LiveAudience/index.tsx and insert the following code:

<View style={{ flex: 1 }}>
{/* ...other content... */}
<View
style={{
position: 'absolute',
top: 100,
left: 15,
width: 100,
height: 30,
backgroundColor: 'rgba(0, 0, 0, 0.3)',
borderRadius: 22.5,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
}}
>
{/* Replace the image address with your resources */}
<Image
style={{ width: 18, height: 18 }}
source={require('/static/images/gift_heart0.png')}
resizeMode="contain"
/>
<Text style={{ color: '#fff', fontSize: 12 }}>8888</Text>
</View>
</View>
Result:


Hide a Button

To hide a button, comment out the relevant code block. The following code shows how to hide the Gift button:
{/* <TouchableOpacity
style={styles.actionBtn}
onPress={showGiftPicker}
activeOpacity={0.7}>
<Image
source={require('react-native-tuikit-atomic-x/src/static/images/live-gift.png')}
style={styles.actionBtnIcon}
resizeMode="contain"
/>
</TouchableOpacity> */}

Next Steps

You’ve now integrated the audience viewing feature. Next, you can add features such as Host Live Start and Live Stream List. See the table below for details:
Feature
Description
Integration Guide
Host Live Start
Complete workflow for host live start, including pre-stream setup and post-stream interaction
Live Stream List
Displays the Live Stream List interface and features, including list and room details

FAQs

Live comments sent by other audience members cannot be seen?

Reason 1: Check the network connection to ensure the audience’s device is online.
Reason 2: The audience has been muted by the host and cannot send live comments.
Reason 3: The live comment contains blocked keywords. Make sure the comment complies with live room rules.

How to display audience levels?

If you need to show audience levels, insert the relevant element at the desired location. For example, to display audience levels in the audience list, locate the audience info display code in the tuikit-atomic-x/src/components/LiveAudienceList.tsx component and add the audience level display code:
<View style={styles.audienceInfo}>
.......
{/* Audience level */}
<Text style={styles.audienceLevel}>{level}</Text>
<View style={styles.audienceAvatarContainer}>
<Image source={{ uri: avatarURL }} style={styles.audienceAvatar} />
</View>
</View>


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백