Camera


interface Camera


The camera interface is used to control the flow of data to use cases, control the camera via the CameraControl, and publish the state of the camera via CameraInfo.

An example of how to obtain an instance of this class can be found in the androidx.camera.lifecycle package.

Summary

Public functions

CameraControl

Returns the CameraControl for the Camera.

CameraInfo

Returns information about this camera.

Public functions

getCameraControl

Added in 1.0.0
fun getCameraControl(): CameraControl

Returns the CameraControl for the Camera.

The CameraControl provides various asynchronous operations like zoom, focus and metering. CameraControl is ready to start operations immediately after use cases are bound to the Camera. When all UseCases are unbound, or when camera is closing or closed because lifecycle onStop happens, the CameraControl will reject all operations.

Each method of CameraControl returns a ListenableFuture which apps can use to check the asynchronous result. If the operation is not allowed in current state, the returned ListenableFuture will fail immediately with CameraControl.OperationCanceledException.

getCameraInfo

Added in 1.0.0
fun getCameraInfo(): CameraInfo

Returns information about this camera.

The returned information can be used to query static camera characteristics or observe the runtime state of the camera.

Returns
CameraInfo

the CameraInfo.