rn-live
v0.0.4
Published
# Info This library based [rtmp-rtsp-stream-client-java](https://github.com/pedroSG94/rtmp-rtsp-stream-client-java) and [LFLiveKit](https://github.com/LaiFengiOS/LFLiveKit)
Downloads
134
Maintainers
Readme
rn-live
Info
This library based rtmp-rtsp-stream-client-java and LFLiveKit
Support iOS and Android
Add it to your project
Run npm install --save rn-live
Android
Add the following lines to
android/settings.gradle
:include ':rn-live' project(':rn-live').projectDir = new File(rootProject.projectDir, '../node_modules/rn-live/android')
Add the compile line to the dependencies in
android/app/build.gradle
:dependencies { compile project(':rn-live') }
Add the required permissions in
AndroidManifest.xml
:<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera2.full" /> <uses-feature android:name="android.hardware.camera2.autofocus" />
Add the import and link the package in
MainApplication.java
:import com.rnlive.RTMPPackage; // <-- add this import public class MainApplication extends Application implements ReactApplication { @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new RTMPPackage() // <-- add this line ); } }
iOS
- In the XCode's "Project navigator", right click on your project's Libraries folder ➜
Add Files to <...>
- Go to
node_modules
➜rn-live
➜ios
➜ selectRCTLFLiveKit.xcodeproj
- Add
libRCTLFLiveKit.a
toBuild Phases -> Link Binary With Libraries
- Go to General -> Embedded Binaries and add LFLiveKit.framework
- Linked Frameworks and Libraries add LFLiveKit.framework
- Compile and have fun
Usage
<RNLive
started={false} // start your stream
cameraFronted={true} // camera front or back
url="rtmp://xxx" // your rtmp publish url
landscape={false} // landscape mode
onReady={() => {}} // streaming ready
onPending={() => {}} // streaming ready to start
onStart={() => {}} // streaming start
onError={() => {}} // straming error
onStop={() => {}} // streaming stop
/>
Options
option | iOS | Android ------ | ---- | ------- cameraFronted | OK | OK started | OK | OK url | OK | OK landscape | OK | - onReady | OK | - onPending | OK | - onStart | OK | - onStop | OK | - onError | OK | - videoEnabled | - | OK audioEnabled | - | OK
License
MIT https://www.npmjs.com/package/rn-live