Skip to main content
Version: Android SDK v1.3.0

Uploading

Our Recorder includes support for uploading the video as it is being recorded, enabling a seamless experience where the video is immediately available to other users after recording, as long as the network connection is fast enough.

The upload-while-recording is enabled by default and can be controlled using the uploadParams field. The field accepts an UploadParams as described in the upload documentation. Note that it should not be changed while video is being recorded.

recorder.uploadParams = null // do not upload while recording
recorder.uploadParams = UploadParams.build { ... } // upload while recording

If uploadParams is not null (default), as soon as recording starts, the SDK will also start uploading it. The user is free to pause and resume recording (for example, to switch camera in between), and the upload will be resumed as well automatically.

Configuring the upload

The upload process will generate a playable Video object. Just like Videos created outside of the recorder (through VideoKit.uploads()), you have the option to set the video tags, title and metadata, by just passing them to the recorder:

recorder.uploadParams = UploadParams.build { // upload while recording
title("My video")
tags("tag")
metadata("key", "value")
}

Handling results

When uploadParams is not null, the final Recording will contain extra information:

recorder.addObserver(object : Recorder.Observer {
override fun onResult(recording: Recording) {
// Since upload request was set, the final record contains an Upload object.
// Use this object with the upload manager (VideoKit.uploads()) to listen for updates.
val upload: Upload = recording.upload!!

// Since upload request was set, we also have a Video object available that is ready to be
// played with the player SDK, even if upload has not finished yet.
val video: Video = recording.video!!
}
})

Coroutine users can collect the Recorder.resultFlow instead.