public final class

VideoCapture.Builder<T extends VideoOutput>

extends java.lang.Object

implements UseCaseConfig.Builder<VideoCapture, VideoCaptureConfig, VideoCapture.Builder>, ImageOutputConfig.Builder<VideoCapture.Builder>, ThreadConfig.Builder<VideoCapture.Builder>

 java.lang.Object

↳androidx.camera.video.VideoCapture.Builder<T>

Overview

Builder for a VideoCapture.

Summary

Methods
public VideoCapture<VideoOutput>build()

Builds an immutable VideoCaptureConfig from the current state.

public static VideoCapture.Builder<VideoOutput>fromConfig(VideoCaptureConfig<VideoOutput> configuration)

Generates a Builder from another Config object

public MutableConfiggetMutableConfig()

public VideoCaptureConfig<VideoOutput>getUseCaseConfig()

public VideoCapture.Builder<VideoOutput>setBackgroundExecutor(java.util.concurrent.Executor executor)

Sets the default executor that will be used for background tasks.

public VideoCapture.Builder<VideoOutput>setCameraSelector(CameraSelector cameraSelector)

public VideoCapture.Builder<VideoOutput>setCaptureOptionUnpacker(CaptureConfig.OptionUnpacker optionUnpacker)

public VideoCapture.Builder<VideoOutput>setDefaultCaptureConfig(CaptureConfig captureConfig)

public VideoCapture.Builder<VideoOutput>setDefaultResolution(Size resolution)

Sets the default resolution of the intended target from this configuration.

public VideoCapture.Builder<VideoOutput>setDefaultSessionConfig(SessionConfig sessionConfig)

public VideoCapture.Builder<VideoOutput>setMaxResolution(Size resolution)

public VideoCapture.Builder<VideoOutput>setSessionOptionUnpacker(SessionConfig.OptionUnpacker optionUnpacker)

public VideoCapture.Builder<VideoOutput>setSupportedResolutions(java.util.List<> resolutions)

public VideoCapture.Builder<VideoOutput>setSurfaceOccupancyPriority(int priority)

public VideoCapture.Builder<VideoOutput>setTargetAspectRatio(int aspectRatio)

Sets the aspect ratio of the intended target for images from this configuration.

public VideoCapture.Builder<VideoOutput>setTargetClass(java.lang.Class<VideoCapture> targetClass)

public VideoCapture.Builder<VideoOutput>setTargetName(java.lang.String targetName)

Sets the name of the target object being configured, used only for debug logging.

public VideoCapture.Builder<VideoOutput>setTargetResolution(Size resolution)

setTargetResolution is not supported on VideoCapture

public VideoCapture.Builder<VideoOutput>setTargetRotation(int rotation)

Sets the rotation of the intended target for images from this configuration.

public VideoCapture.Builder<VideoOutput>setUseCaseEventCallback(UseCase.EventCallback useCaseEventCallback)

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public static VideoCapture.Builder<VideoOutput> fromConfig(VideoCaptureConfig<VideoOutput> configuration)

Generates a Builder from another Config object

Parameters:

configuration: An immutable configuration to pre-populate this builder.

Returns:

The new Builder.

public MutableConfig getMutableConfig()

public VideoCaptureConfig<VideoOutput> getUseCaseConfig()

public VideoCapture<VideoOutput> build()

Builds an immutable VideoCaptureConfig from the current state.

Returns:

A VideoCaptureConfig populated with the current state.

public VideoCapture.Builder<VideoOutput> setTargetClass(java.lang.Class<VideoCapture> targetClass)

public VideoCapture.Builder<VideoOutput> setTargetName(java.lang.String targetName)

Sets the name of the target object being configured, used only for debug logging.

The name should be a value that can uniquely identify an instance of the object being configured.

If not set, the target name will default to an unique name automatically generated with the class canonical name and random UUID.

Parameters:

targetName: A unique string identifier for the instance of the class being configured.

Returns:

the current Builder.

public VideoCapture.Builder<VideoOutput> setTargetAspectRatio(int aspectRatio)

Sets the aspect ratio of the intended target for images from this configuration.

It is not allowed to set both target aspect ratio and target resolution on the same use case.

The target aspect ratio is used as a hint when determining the resulting output aspect ratio which may differ from the request, possibly due to device constraints. Application code should check the resulting output's resolution.

If not set, resolutions with aspect ratio 16:9 will be considered in higher priority.

Parameters:

aspectRatio: A AspectRatio representing the ratio of the target's width and height.

Returns:

The current Builder.

public VideoCapture.Builder<VideoOutput> setTargetRotation(int rotation)

Sets the rotation of the intended target for images from this configuration.

This is one of four valid values: , , , . Rotation values are relative to the "natural" rotation, .

If not set, the target rotation will default to the value of Display of the default display at the time the use case is created. The use case is fully created once it has been attached to a camera.

Parameters:

rotation: The rotation of the intended target.

Returns:

The current Builder.

public VideoCapture.Builder<VideoOutput> setTargetResolution(Size resolution)

setTargetResolution is not supported on VideoCapture

public VideoCapture.Builder<VideoOutput> setDefaultResolution(Size resolution)

Sets the default resolution of the intended target from this configuration.

Parameters:

resolution: The default resolution to choose from supported output sizes list.

Returns:

The current Builder.

public VideoCapture.Builder<VideoOutput> setMaxResolution(Size resolution)

public VideoCapture.Builder<VideoOutput> setSupportedResolutions(java.util.List<> resolutions)

public VideoCapture.Builder<VideoOutput> setBackgroundExecutor(java.util.concurrent.Executor executor)

Sets the default executor that will be used for background tasks.

If not set, the background executor will default to an automatically generated java.util.concurrent.Executor.

Parameters:

executor: The executor which will be used for background tasks.

Returns:

the current Builder.

public VideoCapture.Builder<VideoOutput> setDefaultSessionConfig(SessionConfig sessionConfig)

public VideoCapture.Builder<VideoOutput> setDefaultCaptureConfig(CaptureConfig captureConfig)

public VideoCapture.Builder<VideoOutput> setSessionOptionUnpacker(SessionConfig.OptionUnpacker optionUnpacker)

public VideoCapture.Builder<VideoOutput> setCaptureOptionUnpacker(CaptureConfig.OptionUnpacker optionUnpacker)

public VideoCapture.Builder<VideoOutput> setSurfaceOccupancyPriority(int priority)

public VideoCapture.Builder<VideoOutput> setCameraSelector(CameraSelector cameraSelector)

public VideoCapture.Builder<VideoOutput> setUseCaseEventCallback(UseCase.EventCallback useCaseEventCallback)