Sign up for free Android Upstream: camera + progressive upload 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.

Project description

This library is an easy way to capture your video and microphone and upload it to at the same time.

Getting started



On build.gradle add the following code in dependencies:

dependencies {
    implementation 'video.api:android-upstream:1.1.0'


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

Your application must dynamically require android.permission.CAMERA and android.permission.RECORD_AUDIO.

Code sample

  1. Add 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.

<video.api.upstream.views.ApiVideoView android:id="@+id/apiVideoView"
    android:layout_width="match_parent" android:layout_height="match_parent" />
  1. Create an ApiVideoUpstream instance in your fragment or activity.
class MyFragment : Fragment() {
    private var apiVideoView: ApiVideoView? = null
    private lateinit var upstream: ApiVideoUpstream

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val apiVideoView = view.findViewById(
        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
            context = requireContext(),
            apiKey = apiKey,
            timeout = 60000, // 1 min
            initialAudioConfig = audioConfig,
            initialVideoConfig = videoConfig,
            apiVideoView = apiVideoView
  1. Create or get your video id or create or get an upload token from Alternatively, you can create or get an upload token in the dashboard.

  2. Start your record

If you are using video id:


If you are using an upload token:


For detailed information on this upstream library API, refers to API documentation.


  • 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


Sample application

A demo application demonstrates how to use this upstream library. See /example folder.


We are using external library



If you have any questions, ask us in the community or use issues.

Was this page helpful?