If you have any questions regarding bugs and feature requests, visit the ZEGOCLOUD community .
yarn add @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
- Go to ZEGOCLOUD Admin Console|_blank, get the
appID
andappSign
of your project. - Specify the
userID
anduserName
for connecting the LiveStreaming Kit service. - Create a
liveID
that represents the live streaming you want to make.
-
userID
andcallID
can only contain numbers, letters, and underlines (_). - Using the same
liveID
will enter the same live streaming.
// 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>
);
}
- Android:
Open my_project/android/app/src/main/AndroidManifest.xml
file and add the code as follow:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
- iOS:
Open my_project/ios/my_project/Info.plist
file and add the code as follow:
<key>NSCameraUsageDescription</key>
<string></string>
<key>NSMicrophoneUsageDescription</key>
<string></string>
- Run on an iOS device:
yarn android
- Run on an Android device:
yarn ios