$ npm install react-native-broadcast --save
$ react-native link react-native-broadcast
-
iOS: Add
Privacy - Camera Usage Description
andPrivacy - Microphone Usage Description
to your project's Info.plist -
Android: Add the following permissions to your Android Manifest
<uses-permission android:name="android.permission.RECORD_AUDIO"/> <uses-permission android:name="android.permission.RECORD_VIDEO"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-broadcast
and addRNBroadcast.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNBroadcast.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)< - Need to add Link binary to
libz
&libstdc++
into final project
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNBroadcastPackage;
to the imports at the top of the file - Add
new RNBroadcastPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-broadcast' project(':react-native-broadcast').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-broadcast/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-broadcast')
- Start publishing by providing an rtmpURL.
- Stop publishing by providing an empty string: ''
- Camera Position can be either 'front' or 'back'
import BroadcastView from 'react-native-broadcast';
<BroadcastView
publish='rtmp://a.rtmp.youtube.com/live2/...'
cameraPosition='front'
/>