提交工单
咨询集成、功能及报价等问题
yarn add @zegocloud/zego-uikit-prebuilt-live-streaming-rn
npm install @zegocloud/zego-uikit-prebuilt-live-streaming-rn
Run the following command to install other dependencies for making sure the @zegocloud/zego-uikit-prebuilt-live-streaming-rn
can work properly:
yarn add @zegocloud/zego-uikit-rn react-delegate-component zego-express-engine-reactnative@3.2.0
npm install @zegocloud/zego-uikit-rn react-delegate-component zego-express-engine-reactnative@3.2.0
appID
and appSign
of your project.userID
and userName
for connecting the LiveStreaming Kit service. liveID
that represents the live streaming you want to make. userID
and liveID
can only contain numbers, letters, and underlines (_). liveID
will enter the same live streaming.With the same liveID
, only one user can enter the live stream as host. Other users need to enter the live stream as the audience.
// HostPage.js
import React from 'react';
import { StyleSheet, View } from 'react-native';
import ZegoUIKitPrebuiltLiveStreaming, { HOST_DEFAULT_CONFIG } from '@zegocloud/zego-uikit-prebuilt-live-streaming-rn'
export default function HostPage(props) {
return (
<View style={styles.container}>
<ZegoUIKitPrebuiltLiveStreaming
appID={yourAppID}
appSign={yourAppSign}
userID={userID}
userName={userName}
liveID={liveID}
config={{
...HOST_DEFAULT_CONFIG,
onLeaveLiveStreaming: () => { props.navigation.navigate('HomePage') }
}}
/>
</View>
);
}
my_project/android/app/src/main/AndroidManifest.xml
file and add the following:<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE"/>
my_project/android/app/proguard-rules.pro
file and add the following:-keep class **.zego.** { *; }
Open the my_project/ios/my_project/Info.plist
file and add the following:
<key>NSCameraUsageDescription</key>
<string>We need to use the camera</string>
<key>NSMicrophoneUsageDescription</key>
<string>We need to use the microphone</string>
If your device is not performing well or you found a UI stuttering, run in Release mode for a smoother experience.
yarn ios
npm run ios
yarn android
npm run android