A recorder can be used to save the video frames sent from the
VideoCapture use case
in common recording formats such as MPEG4.
Usage example of setting up
VideoCapture with a recorder as output:
ProcessCameraProvider cameraProvider = ...; CameraSelector cameraSelector = ...; ... // Create our preview to show on screen Preview preview = new Preview.Builder.build(); // Create the video capture use case with a Recorder as the output VideoCapture
videoCapture = VideoCapture.withOutput(new Recorder.Builder().build()); // Bind use cases to Fragment/Activity lifecycle cameraProvider.bindToLifecycle(this, cameraSelector, preview, videoCapture);
Once the recorder is attached to a video source as a
VideoOutput, e.g. using it to
VideoCapture by calling
VideoCapture.withOutput(VideoOutput), a new
recording can be generated with one of the prepareRecording methods, such as
prepareRecording(Context, MediaStoreOutputOptions). The
then can be used to adjust per-recording settings and to start the recording. It also requires
passing a listener to
PendingRecording.start(Executor, Consumer) to
VideoRecordEvents such as
VideoRecordEvent.Finalize. This listener will also receive regular recording status
updates via the
A recorder can also capture and save audio alongside video. The audio must be explicitly
PendingRecording.withAudioEnabled() before starting the recording.
Builder class for
Default quality selector for recordings.
Returns the executor provided to the builder for this recorder.
Gets the quality selector of this Recorder.
Called when a new
Prepares a recording that will be saved to a