All Projects → shogo4405 → HaishinKit.kt

shogo4405 / HaishinKit.kt

Licence: BSD-3-Clause License
Camera and Microphone streaming library via RTMP for Android.

Programming Languages

kotlin
9241 projects
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to HaishinKit.kt

Haishinkit.swift
Camera and Microphone streaming library via RTMP, HLS for iOS, macOS, tvOS.
Stars: ✭ 2,237 (+3095.71%)
Mutual labels:  streaming, camera, rtmp
Rtmp Rtsp Stream Client Java
Library to stream in rtmp and rtsp for Android. All code in Java
Stars: ✭ 1,338 (+1811.43%)
Mutual labels:  streaming, rtmp
Android Rtmp Muxer
Implementation of the RTMP protocol to broadcast video and audio on Android in pure Java
Stars: ✭ 78 (+11.43%)
Mutual labels:  streaming, rtmp
browserLiveStream
Use webcam, browser and Node to stream live video. From api.video (https://api.video)
Stars: ✭ 141 (+101.43%)
Mutual labels:  streaming, rtmp
Ovenmediaengine
OvenMediaEngine (OME) is a streaming engine for real-time live broadcasting with sub-second latency.
Stars: ✭ 760 (+985.71%)
Mutual labels:  streaming, rtmp
Rtsp Simple Server
ready-to-use RTSP / RTMP server and proxy that allows to read, publish and proxy video and audio streams
Stars: ✭ 882 (+1160%)
Mutual labels:  streaming, rtmp
Ffplayout Engine
python and ffmpeg based playout
Stars: ✭ 128 (+82.86%)
Mutual labels:  streaming, rtmp
Rtspallthethings
Deprecated RTSP media server -- Use github.com/aler9/rtsp-simple-server instead.
Stars: ✭ 258 (+268.57%)
Mutual labels:  streaming, camera
Rtsp.player.android
RTSP player for Android / IP camera viewer
Stars: ✭ 199 (+184.29%)
Mutual labels:  streaming, rtmp
Nginx Rtmp Monitoring
real-time monitoring statistics dashboard for nginx rtmp module
Stars: ✭ 224 (+220%)
Mutual labels:  streaming, rtmp
Ffmpeg
Mirror of https://git.ffmpeg.org/ffmpeg.git
Stars: ✭ 27,382 (+39017.14%)
Mutual labels:  streaming, rtmp
minirtmp
Mini RTMP
Stars: ✭ 57 (-18.57%)
Mutual labels:  streaming, rtmp
Instagramlive Php
A PHP script that allows for you to go live on Instagram with any streaming program that supports RTMP!
Stars: ✭ 362 (+417.14%)
Mutual labels:  streaming, rtmp
Onvifcamera
Pod and example on how to connect to an ONVIF camera
Stars: ✭ 66 (-5.71%)
Mutual labels:  streaming, camera
Multistreamer
[discontinued] A webapp for publishing video to multiple streaming services at once.
Stars: ✭ 281 (+301.43%)
Mutual labels:  streaming, rtmp
Streaming Room
Streaming room in Node.js, rtmp, hsl, html5 videojs player
Stars: ✭ 106 (+51.43%)
Mutual labels:  streaming, rtmp
lovelace-hass-aarlo
Lovelace card for hass-aarlo integration.
Stars: ✭ 41 (-41.43%)
Mutual labels:  streaming, camera
Srs
SRS is a simple, high efficiency and realtime video server, supports RTMP, WebRTC, HLS, HTTP-FLV, SRT and GB28181.
Stars: ✭ 16,734 (+23805.71%)
Mutual labels:  streaming, rtmp
Rtmp Streamer
浏览器RTMP推流SDK (A javascript rtmp streamer library)
Stars: ✭ 156 (+122.86%)
Mutual labels:  streaming, rtmp
tms
tms(toy media server) is a toy media server for myself learning media develop. Just for fun.
Stars: ✭ 29 (-58.57%)
Mutual labels:  streaming, rtmp

HaishinKit.kt

GitHub license

  • Camera and Microphone streaming library via RTMP for Android.
  • API Documentation
  • Issuesの言語は、日本語が分かる方は日本語でお願いします!

Communication

  • If you need help with making LiveStreaming requests using HaishinKit, use a GitHub issue with Bug report template
    • If you don't use an issue template. I will immediately close the your issue without a comment.
  • If you'd like to discuss a feature request, use a GitHub issue with Feature request template.
  • If you want to support e-mail based communication without GitHub issue.
    • Consulting fee is $50/1 incident. I'm able to response a few days.
  • If you want to contribute, submit a pull request!

Features

RTMP

  • Authentication
  • Publish (H264/AAC)
  • Playback
  • Action Message Format
    • AMF0
    • AMF3
  • SharedObject
  • RTMPS
    • Native (RTMP over SSL/TSL)

Filter

  • Monochrome

Sources

  • Camera with Camera2 api
  • MediaProjection
  • Microphone with AudioRecord api.

View rendering

- HkSurfaceView HkTextureView
Engine SurfaceView TextureView
Playback beta beta
Publish Stable Stable
Note Recommend Android 7.0+ Recommend Android 5.0-6.0

Others

  • Hardware acceleration for H264 video encoding/AAC audio encoding.
    • Asynchronously processing.
  • Graphics api
    • OpenGL
    • Vulkan

License

BSD-3-Clause

Donation

Paypal

Bitcoin

3FnjC3CmwFLTzNY5WPNz4LjTo1uxGNozUR

Usage

Gradle dependency

repositories {
  maven {
    url = uri("https://maven.pkg.github.com/shogo4405/HaishinKit.kt")
    credentials {
      username = System.getenv("GITHUB_USER")
      password = System.getenv("GITHUB_API_TOKEN")
    }
  }
}

dependencies {
    implementation 'com.haishinkit:haishinkit:x.x.x'
}

Android manifest

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Requirements

- Android
0.7.0 5.0+

Prerequisites

ActivityCompat.requestPermissions(this,arrayOf(
    Manifest.permission.CAMERA,
    Manifest.permission.RECORD_AUDIO
), 1)

RTMP Usage

Real Time Messaging Protocol (RTMP).

class CameraTabFragment: Fragment(), IEventListener {
    private lateinit var connection: RtmpConnection
    private lateinit var stream: RtmpStream
    private lateinit var cameraView: HkGLSurfaceView
    private lateinit var cameraSource: CameraSource

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        activity?.let {
            val permissionCheck = ContextCompat.checkSelfPermission(it, Manifest.permission.CAMERA)
            if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(it, arrayOf(Manifest.permission.CAMERA), 1)
            }
            if (ContextCompat.checkSelfPermission(it, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(it, arrayOf(Manifest.permission.RECORD_AUDIO), 1)
            }
        }
        connection = RtmpConnection()
        stream = RtmpStream(connection)
        stream.attachAudio(AudioRecordSource())
        cameraSource = CameraSource(requireContext()).apply {
            open(CameraCharacteristics.LENS_FACING_BACK)
        }
        stream.attachVideo(cameraSource)
        connection.addEventListener(Event.RTMP_STATUS, this)
    }

    @SuppressLint("SetTextI18n")
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        val v = inflater.inflate(R.layout.fragment_camera, container, false)
        val button = v.findViewById<Button>(R.id.button)
        button.setOnClickListener {
            if (button.text == "Publish") {
                connection.connect(Preference.shared.rtmpURL)
                button.text = "Stop"
            } else {
                connection.close()
                button.text = "Publish"
            }
        }
        val switchButton = v.findViewById<Button>(R.id.switch_button)
        switchButton.setOnClickListener {
            cameraSource.switchCamera()
        }
        cameraView = v.findViewById(R.id.camera)
        cameraView.attachStream(stream)
        return v
    }

    override fun onDestroy() {
        super.onDestroy()
        connection.dispose()
    }

    override fun handleEvent(event: Event) {
        Log.i("$TAG#handleEvent", event.toString())
        val data = EventUtils.toMap(event)
        val code = data["code"].toString()
        if (code == RtmpConnection.Code.CONNECT_SUCCESS.rawValue) {
            stream.publish(Preference.shared.streamName)
        }
    }

    companion object {
        fun newInstance(): CameraTabFragment {
            return CameraTabFragment()
        }

        private val TAG = CameraTabFragment::class.java.simpleName
    }
}

Filter API (v0.1)

- [assets]
  - [shaders]
    - custom-shader.vert(optional)
    - custom-shader.frag
package my.custom.filter

import com.haishinkit.graphics.filter.VideoEffect

class Monochrome2VideoEffect(
    override val name: String = "custom-shader"
) : VideoEffect
stream.videoEffect = Monochrome2VideoEffect()

FAQ

How can I run example project?

git clone https://github.com/shogo4405/HaishinKit.kt.git
cd HaishinKit.kt
git submodule update --init

# Open [Android Studio] -> [Open] ...

RTML URL Format

  • rtmp://server-ip-address[:port]/application/[appInstance]/[prefix:[path1[/path2/]]]streamName
    • [] mark is an Optional.
    rtmpConneciton.connect("rtmp://server-ip-address[:port]/application/[appInstance]")
    rtmpStream.publish("[prefix:[path1[/path2/]]]streamName")
    
  • rtmp://localhost/live/streamName
    rtmpConneciton.connect("rtmp://localhost/live")
    rtmpStream.publish("streamName")
    

Related Project

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].