Skip to content

gibsmon/simple-rtmpServer-kotlin

Repository files navigation

Simple RTMP Server for Android Kotlin

Status

About

this app just shorten the code and main function for RTMP live stream, to get more features you can get from here : https://github.com/pedroSG94/rtmp-rtsp-stream-client-java

🏁 Getting Started

implementation 'com.github.gibsmon:simple-rtmpServer-kotlin:Tag'

Add To Gradle

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

Add To Manifest

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <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-permission android:name="android.permission.READ_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 to Layout

     <SurfaceView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/surfaceView"
        />

On Activity

    lateinit var surfaceView: SurfaceView
    lateinit var a: RtmpServer

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
        setContentView(R.layout.activity_camera_demo)

        surfaceView = findViewById(R.id.surfaceView)
//        activity, surfaceView
        a = RtmpServer(this, surfaceView)
//        context
        a.initSurfaceView(applicationContext)
//        url rtmp
        a.startStreaming("rtmp url")
    }

Stop Stream

  a.stopStreaming()

Switch Camera

  a.changeCamera()

About

Simple RTMP Server for Android Kotlin

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages