HaishinKit.kt

Introduction: [WIP]Camera and Microphone streaming library via RTMP for Android.
More: Author   ReportBugs   
Tags:

Android CI JitPack Android API 23+ BSD-3-Clause Sponsor

A Kotlin library for capturing, composing, recording, publishing, and playing camera and microphone streams on Android using RTMP/RTMPS, SRT, and WHIP/WHEP.

API reference · Releases · Sample app

🎨 Features

  • RTMP/RTMPS publishing and playback, including H.264/AAC and Enhanced RTMP HEVC support.
  • Experimental SRT publishing and playback with MPEG-TS, H.264/H.265, AAC, and encryption.
  • Experimental WHIP publishing and WHEP playback with H.264/Opus over WebRTC.
  • A common StreamSession interface for protocol-specific publishing and playback.
  • Camera and microphone capture, multiple cameras, and streaming to multiple destinations.
  • Video compositions with text, images, and optional Lottie animations; preview and recording outputs.
  • Jetpack Compose integration and an optional experimental Vulkan output backend.

📦 Installation

Add JitPack alongside your existing repositories in settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

Add the core library and your transport module in your app's build.gradle.kts:

dependencies {
    val haishinkitVersion = "0.20.3"
    implementation("com.github.HaishinKit.HaishinKit~kt:haishinkit:$haishinkitVersion")
    implementation("com.github.HaishinKit.HaishinKit~kt:rtmp:$haishinkitVersion")
}

Use HaishinKit~kt in JitPack coordinates. Keep all modules on the same version. The example uses the published 0.20.3 release; main is the development branch and may include changes absent from that release or the published API reference.

Module Minimum Android Purpose
haishinkit 6.0 / API 23 Required core: capture, composition, codecs, and recording
rtmp 6.0 / API 23 RTMP/RTMPS transport
srt 6.0 / API 23 Experimental SRT transport
rtc 6.0 / API 23 Experimental WHIP/WHEP transport
compose 6.0 / API 23 Jetpack Compose views
lottie 6.0 / API 23 Lottie animations in compositions
vulkan 9.0 / API 28 Experimental Vulkan output

Add optional modules using the same coordinates, replacing rtmp with the module name. RTC audio publishing requires an Opus encoder, provided by Android 10+.

📚 Documentation

Use the Dokka API reference for media capture and composition, stream sessions, recording, and protocol APIs. The module guides are included in generated documentation:

Source guides track main; consult the matching release tag when integrating a published version.

🐾 Examples

Publishing, settings and screen sharing in the Android sample (English, Pixel 5a):

Android sample publishing screen with a live camera preview in English on a Pixel 5a Android sample settings screen in English on a Pixel 5a Android sample screen-sharing screen in English on a Pixel 5a

The Android sample app demonstrates camera publishing, playback, recording, screen sharing, and screen composition. It requires Android 10 (API 29) or later, plus a streaming server and endpoints for network testing.

git clone --recurse-submodules https://github.com/HaishinKit/HaishinKit.kt.git
cd HaishinKit.kt

Open the repository in Android Studio and run the app configuration. See the sample guide for setup, permissions, and protocol settings. When reporting a problem, check whether it also occurs in the sample app.

💖 Support

Technical support through Issues and Discussions is available to contributors, academic researchers, and sponsors. The $50/month sponsorship tier includes priority technical support.

📜 License

BSD 3-Clause. The optional RTC module bundles libdatachannel (MPL-2.0) and other dependencies; see its third-party notices.

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools
AI Daily Digest