Skip to main content
Version: Android SDK v1.2.1

Previewing

Our Recorder has built-in support for previewing the video that has just been recorded, offering a natural confirmation screen before the upload is confirmed. At this point, the user can choose to:

  • go back to recording (for example, to record more clips)
  • confirm. In this case the RecordListener.onResult(record) function will be invoked soon

With default controls

When using the default controls, you can choose whether a preview will be shown by modifying the RecorderControls.showPreviewScreen flag:

recorder.controls.showPreviewScreen = false // don't go through preview phase
recorder.controls.showPreviewScreen = true // go through preview phase

If showPreviewScreen is true (default), as soon as the recording is confirmed by the user, the video will be previewed and the recorder state will move to RecorderState.PREVIEW.

With custom controls

If you are not using RecorderControls, you can enter and exit the preview state using the following functions:

// Calling this will move state to RecorderState.PREVIEW, if there's something to preview
// or, in other words, recorder.record != null
recorder.enterPreview()

// Use this to go back to the recording UI in RecorderState.IDLE. All video information is kept,
// so that user can record more clips, or discard them using cancelRecord() / popClip().
recorder.exitPreview()

We also offer controls specific to the RecorderState.PREVIEW state:

// Playback
recorder.setPreviewPlayback(true) // start playing
recorder.setPreviewPlayback(false) // stop playing
recorder.togglePreviewPlayback() // toggle it

// Show preview time
recorder.addListener(object : RecorderListener {
override fun onPreviewTimeChanged(previewTime: Long) {
// Preview is playing at previewTime milliseconds.
}
})