https://github.com/apivideo/api.video-android-live-stream
Android RTMP live stream client. Made with ♥ by api.video
https://github.com/apivideo/api.video-android-live-stream
android kotlin live-streaming live-streaming-videos rtmp video
Last synced: 6 months ago
JSON representation
Android RTMP live stream client. Made with ♥ by api.video
- Host: GitHub
- URL: https://github.com/apivideo/api.video-android-live-stream
- Owner: apivideo
- License: mit
- Created: 2021-04-16T07:38:08.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-24T14:08:54.000Z (9 months ago)
- Last Synced: 2025-04-02T20:09:48.553Z (6 months ago)
- Topics: android, kotlin, live-streaming, live-streaming-videos, rtmp, video
- Language: Kotlin
- Homepage: https://api.video
- Size: 1010 KB
- Stars: 51
- Watchers: 4
- Forks: 6
- Open Issues: 2
-
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-android-live-stream)
[](https://community.api.video)
Android RTMP live stream client
[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)
- [Code sample](#code-sample)
- [Tips](#tips)
- [Documentation](#documentation)
- [Dependencies](#dependencies)
- [Sample application](#sample-application)
- [FAQ](#faq)## Project description
This library is an easy way to broadcast livestream to api.video platform on Android.
## Getting started
### Installation
#### Gradle
On build.gradle add the following code in dependencies:
```groovy
dependencies {
implementation 'video.api:android-live-stream:1.4.3'
}
```### Permissions
```xml
```
Your application must dynamically require `android.permission.CAMERA`
and `android.permission.RECORD_AUDIO`.### Code sample
1. Add [permissions](#permissions) to your `AndroidManifest.xml` and request them in your
Activity/Fragment.
2. Add a `ApiVideoView` to your Activity/Fragment layout for the camera preview.```xml
```
3. Implement a `IConnectionListener`.
```kotlin
val connectionListener = object : IConnectionListener {
override fun onConnectionSuccess() {
//Add your code here
}override fun onConnectionFailed(reason: String?) {
//Add your code here
}override fun onDisconnect() {
//Add your code here
}
}
```4. Create an `ApiVideoLiveStream` instance.
```kotlin
class MyFragment : Fragment(), IConnectionListener {
private var apiVideoView: ApiVideoView? = null
private lateinit var apiVideo: ApiVideoLiveStreamoverride fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)val apiVideoView = view.findViewById(R.id.apiVideoView)
val audioConfig = AudioConfig(
bitrate = 128 * 1000, // 128 kbps
sampleRate = 44100, // 44.1 kHz
stereo = true,
echoCanceler = true,
noiseSuppressor = true
)
val videoConfig = VideoConfig(
bitrate = 2 * 1000 * 1000, // 2 Mbps
resolution = Resolution.RESOLUTION_720,
fps = 30
)
apiVideo =
ApiVideoLiveStream(
context = getContext(),
connectionListener = this,
initialAudioConfig = audioConfig,
initialVideoConfig = videoConfig,
apiVideoView = apiVideoView
)
}
}
```5. Start your stream with `startStreaming` method
For detailed information on this livestream library API, refers
to [API documentation](https://apivideo.github.io/api.video-android-live-stream/).## Tips
You can check device supported configurations by using the helper: `Helper`
## Documentation
* [API documentation](https://apivideo.github.io/api.video-android-live-stream/)
* [api.video documentation](https://docs.api.video/)## Dependencies
We are using external library
| Plugin | README |
| ------ | ------ |
| [StreamPack](https://github.com/ThibaultBee/StreamPack) | [README.md](https://github.com/ThibaultBee/StreamPack/blob/master/README.md) |## Sample application
A demo application demonstrates how to use this livestream library. See `/example` folder.
## FAQ
If you have any questions, ask us here: 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]: