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
Recorder.Observer.onResult(recording)
function will be invoked soon
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.recording != 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.
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.addObserver(object : Recorder.Observer {
override fun onPreviewTimeChanged(previewTime: Long) {
// Preview is playing at previewTime milliseconds.
}
})
Coroutine users can collect Recorder.previewTimeFlow
instead.