Giter VIP home page Giter VIP logo

rnlive's Introduction

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

  1. Add the following lines to android/settings.gradle:

    include ':rn-live'
    project(':rn-live').projectDir = new File(rootProject.projectDir, '../node_modules/rn-live/android')
  2. Add the compile line to the dependencies in android/app/build.gradle:

    dependencies {
        compile project(':rn-live')
    }
  3. 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" />
    
  4. 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

  1. In the XCode's "Project navigator", right click on your project's Libraries folder ➜ Add Files to <...>
  2. Go to node_modulesrn-liveios ➜ select RCTLFLiveKit.xcodeproj
  3. Add libRCTLFLiveKit.a to Build Phases -> Link Binary With Libraries
  4. Go to General -> Embedded Binaries and add LFLiveKit.framework
  5. Linked Frameworks and Libraries add LFLiveKit.framework
  6. 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

rnlive's People

Contributors

i3i2uno avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.