https://github.com/apivideo/api.video-rtmpdroid
librtmp wrapper for Android. Made with ♥ by api.video
https://github.com/apivideo/api.video-rtmpdroid
android live-streaming rtmp
Last synced: 3 months ago
JSON representation
librtmp wrapper for Android. Made with ♥ by api.video
- Host: GitHub
- URL: https://github.com/apivideo/api.video-rtmpdroid
- Owner: apivideo
- License: mit
- Created: 2022-02-15T09:21:40.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-12T14:52:04.000Z (over 1 year ago)
- Last Synced: 2025-04-09T17:59:59.616Z (6 months ago)
- Topics: android, live-streaming, rtmp
- Language: Kotlin
- Homepage: https://api.video
- Size: 452 KB
- Stars: 27
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://twitter.com/intent/follow?screen_name=api_video)
[](https://github.com/apivideo/api.video-rtmpdroid)
[](https://community.api.video)
api.video Android live stream library
[api.video](https://api.video) is the video infrastructure for product builders. Lightning fast
video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in
your app.# Table of contents
- [Table of contents](#table-of-contents)
- [Project description](#project-description)
- [Getting started](#getting-started)
- [Installation](#installation)
- [Gradle](#gradle)
- [Permissions](#permissions)
- [Documentation](#documentation)
- [FAQ](#faq)# Project description
When it comes to Real-Time Messaging Protocol (RTMP), the most popular implementation is the C
library: [librtmp](http://git.ffmpeg.org/rtmpdump). However, if you are streaming from Android and
want to use librtmp, you need to go through the following painful steps:- compile librtmp for all Android architectures to generate multiple shared libraries
- write a code that links the librtmp C functions to the Java classes/methods using Java Native
Interface (JNI)
- write Java classes/methodsrtmpdroid has been built to address this pain: you can directly use librtmp in your Android
application like any other Java/Kotlin library.rtmpdroid also comes with a minimalist Action Message Format (AMF) encoder that is included in
librtmp.# Getting started
## Installation
### Gradle
In build.gradle, add the following code:
```groovy
dependencies {
implementation 'video.api:rtmpdroid:1.2.1'
}
```## Code sample
### RTMP
```kotlin
val rtmp = Rtmp()
rtmp.connect("rtmp://broadcast.api.video/s/YOUR_STREAM_KEY")
rtmp.connectStream()while (true) {
val flvBuffer = getNewFlvFrame() // flvBuffer is a direct ByteBuffer
rtmp.write(flvBuffer)
}
```### AMF
```kotlin
val amfEncoder = AmfEncoder()amfEncoder.add("myParam", 3.0)
val ecmaArray = EcmaArray()
ecmaArray.add("myOtherParam", "value")
amfEncoder.add(ecmaArray)val amfBuffer = amfEncoder.encode()
```## Permissions
```xml
```
## Packed version
The default version of `rtmpdroid` comes with the following shared libraries:
- librtmp.so
- libssl.so
- libcrypto.so
- librtmpdroid.soHowever, your application might already use `libssl` and `libcrypto`. In this case, you can use the
packed version of `rtmpdroid`. It only contains only `librtmpdroid.so` and the other libraries are
contains in this library.
To use the packed version, add a `-packed` suffix to the `rtmpdroid` version in your `build.gradle`:```groovy
dependencies {
implementation 'video.api:rtmpdroid:1.2.0-packed'
}
```# Documentation
* [API documentation](https://apivideo.github.io/api.video-rtmpdroid/)
* [api.video documentation](https://docs.api.video)# FAQ
If you have any questions, ask us in [https://community.api.video](https://community.api.video) or
use [Issues].[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)
[Issues]: