Skip to main content
Version: Android SDK v1.2.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 upload field. The field accepts an UploadRequest as described in the upload documentation. Note that it should not be changed while video is being recorded.

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

If upload 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.upload = UploadRequest.build { // upload while recording
title("My video")
tags("tag")
metadata("key", "value")
}

Limitations

The only limitation is that you are not allowed to use the Recorder.removeLastClip() API, because the last clip might have already been uploaded.

Handling results

When upload is not null, the final Record will contain extra information:

recorder.addListener(object : RecorderListener {
override fun onResult(record: Record) {
// 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 = record.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 = record.video!!
}
})