Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apivideo/api.video-android-upstream
Record your camera and microphone. Upload your video at the same time.
https://github.com/apivideo/api.video-android-upstream
android library service video
Last synced: about 1 month ago
JSON representation
Record your camera and microphone. Upload your video at the same time.
- Host: GitHub
- URL: https://github.com/apivideo/api.video-android-upstream
- Owner: apivideo
- License: mit
- Created: 2022-05-16T15:50:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-21T17:02:21.000Z (12 months ago)
- Last Synced: 2024-09-27T00:01:51.415Z (about 1 month ago)
- Topics: android, library, service, video
- Language: Kotlin
- Homepage: https://api.video
- Size: 10.3 MB
- Stars: 24
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![badge](https://img.shields.io/twitter/follow/api_video?style=social)](https://twitter.com/intent/follow?screen_name=api_video)
[![badge](https://img.shields.io/github/stars/apivideo/api.video-android-upstream?style=social)](https://github.com/apivideo/api.video-android-upstream)
[![badge](https://img.shields.io/discourse/topics?server=https%3A%2F%2Fcommunity.api.video)](https://community.api.video)
![](https://github.com/apivideo/.github/blob/main/assets/apivideo_banner.png)Android Upstream: camera + progressive upload
[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)
- [Sample application](#sample-application)
- [Dependencies](#dependencies)
- [FAQ](#faq)## Project description
This library is an easy way to capture your video and microphone and upload it
to [api.video](https://api.video/) at the same time.## Getting started
### Installation
#### Gradle
On build.gradle add the following code in dependencies:
```groovy
dependencies {
implementation 'video.api:android-upstream:1.1.0'
}
```### 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. Create an `ApiVideoUpstream` instance in your fragment or activity.
```kotlin
class MyFragment : Fragment() {
private var apiVideoView: ApiVideoView? = null
private lateinit var upstream: ApiVideoUpstreamoverride 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 = 4 * 1000 * 1000, // 4 Mbps
resolution = Resolution.RESOLUTION_720,
fps = 30
)
ApiVideoUpstream(
context = requireContext(),
apiKey = apiKey,
timeout = 60000, // 1 min
initialAudioConfig = audioConfig,
initialVideoConfig = videoConfig,
apiVideoView = apiVideoView
)
}
}
```4. [Create or get your video id](https://github.com/apivideo/api.video-android-client#videosapi)
or [create or get an upload token](https://github.com/apivideo/api.video-android-client#uploadtokensapi)
from [api.video](https://api.video/)
Alternatively, you can create or get an upload token in
the [dashboard](https://dashboard.api.video/upload-tokens).5. Start your record
If you are using video id:
```kotlin
upstream.startStreamingForVideoId("YOUR_VIDEO_ID")
```If you are using an upload token:
```kotlin
upstream.startStreamingForToken("YOUR_UPLOAD_TOKEN")
```For detailed information on this upstream library API, refers
to [API documentation](https://apivideo.github.io/api.video-android-upstream/).## Tips
* If a part of the video is not uploaded, you can resume the upload by creating a
new `MultiFileUploader` with `ApiVideoUpstream.loadExistingSession`.
* You can check device supported configurations by using the helper: `Helper`## Documentation
* [API documentation](https://apivideo.github.io/api.video-android-upstream/)
* [api.video documentation](https://docs.api.video/)## Sample application
A demo application demonstrates how to use this upstream library. See `/example` folder.
## 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) |## FAQ
If you have any questions, ask us in the [community](https://community.api.video) or
use [issues](https://github.com/apivideo/api.video-android-upstream/issues).