# LifecycleCameraController

Artifact: [androidx.camera:camera-view](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/view/LifecycleCameraController.java+class:androidx.camera.view.LifecycleCameraController) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

*** ** * ** ***

<br />

```
class LifecycleCameraController : CameraController
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.camera.view.CameraController](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController) ||
|   | ↳ | [androidx.camera.view.LifecycleCameraController](https://developer.android.com/reference/kotlin/androidx/camera/view/LifecycleCameraController) |

*** ** * ** ***

A controller that provides most of the CameraX features.

This a high level controller that provides most of the CameraX core features in a single class. It handles camera initialization, creates and configures `https://developer.android.com/reference/kotlin/androidx/camera/core/UseCase`s, and bind them to a `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` when ready. It also listens to device motion sensor and set the target rotation for the use cases.

Code sample:

```kotlin
    // Setup.
    CameraController controller = new LifecycleCameraController(context);
    controller.bindToLifecycle(lifecycleOwner);
    PreviewView previewView = findViewById(R.id.preview_view);
    previewView.setController(controller);

    // Use case features
    controller.takePicture(...);

    // Camera control features
    controller.setZoomRatio(.5F);
```

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/view/LifecycleCameraController#LifecycleCameraController(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/camera/view/LifecycleCameraController#bindToLifecycle(androidx.lifecycle.LifecycleOwner)(lifecycleOwner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner)` Sets the `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` to be bound with the controller. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/camera/view/LifecycleCameraController#unbind()()` Clears the previously set `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` and stops the camera. |

### Inherited Constants

From [androidx.camera.view.CameraController](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController) `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#COORDINATE_SYSTEM_VIEW_REFERENCED() = 1`

**This property is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis#COORDINATE_SYSTEM_VIEW_REFERENCED()` instead.

<br />

`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#IMAGE_ANALYSIS() = 2`

Bitmask option to enable `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis`.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#IMAGE_CAPTURE() = 1`

Bitmask option to enable `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture`.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#TAP_TO_FOCUS_FAILED() = 4`

The previous tap-to-focus action was failed to complete.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#TAP_TO_FOCUS_FOCUSED() = 2`

The previous tap-to-focus action was completed successfully and the camera is focused.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#TAP_TO_FOCUS_NOT_FOCUSED() = 3`

The previous tap-to-focus action was completed successfully but the camera is still unfocused, similar to the `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata.html#CONTROL_AF_STATE_NOT_FOCUSED_LOCKED` state.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#TAP_TO_FOCUS_NOT_STARTED() = 0`

No tap-to-focus action has been started by the end user.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#TAP_TO_FOCUS_STARTED() = 1`

A tap-to-focus action has started but not completed.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#VIDEO_CAPTURE() = 4`

Bitmask option to enable video capture use case.

### Inherited functions

From [androidx.camera.view.CameraController](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#clearEffects()()`

Removes all effects.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#clearImageAnalysisAnalyzer()()`

Removes a previously set analyzer.
`https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/java/lang/Void.html!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#enableTorch(boolean)(torchEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Enable the torch or disable the torch.
`https://developer.android.com/reference/kotlin/androidx/camera/core/CameraControl?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getCameraControl()()`

Gets the `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraControl` of the currently attached camera.
`https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getCameraInfo()()`

Gets the `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo` of the currently attached camera.
`https://developer.android.com/reference/kotlin/androidx/camera/core/CameraSelector` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getCameraSelector()()`

Gets the `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraSelector`.
`https://developer.android.com/reference/java/util/concurrent/Executor.html?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageAnalysisBackgroundExecutor()()`

Gets the default executor for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis` background tasks.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageAnalysisBackpressureStrategy()()`

Returns the mode with which images are acquired.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageAnalysisImageQueueDepth()()`

Gets the image queue depth of `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageAnalysisOutputImageFormat()()`

Gets the output image format for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis`.
`https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageAnalysisResolutionSelector()()`

Returns the `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector` for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis`.
`https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[getImageAnalysisTargetSize](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageAnalysisTargetSize())()`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageAnalysisResolutionSelector()` instead.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageCaptureFlashMode()()`

Gets the flash mode for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture`.
`https://developer.android.com/reference/java/util/concurrent/Executor.html?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageCaptureIoExecutor()()`

Gets the default executor for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture` IO tasks.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageCaptureMode()()`

Returns the image capture mode.
`https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageCaptureResolutionSelector()()`

Returns the `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector` for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture`.
`https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[getImageCaptureTargetSize](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageCaptureTargetSize())()`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getImageCaptureResolutionSelector()` instead.

<br />

`https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/java/lang/Void.html!>` `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getInitializationFuture()()`

Gets a `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` that completes when camera initialization completes.
`https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getPreviewResolutionSelector()()`

Returns the `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector` for `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview`.
`https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[getPreviewTargetSize](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getPreviewTargetSize())()`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getPreviewResolutionSelector()` instead.

<br />

`https://developer.android.com/reference/kotlin/androidx/lifecycle/LiveData<https://developer.android.com/reference/kotlin/androidx/camera/view/TapToFocusInfo!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getTapToFocusInfoState()()`

Returns a `https://developer.android.com/reference/kotlin/androidx/lifecycle/LiveData` with a `https://developer.android.com/reference/kotlin/androidx/camera/view/TapToFocusInfo` containing the latest focus state and corresponding tap position.
`https://developer.android.com/reference/kotlin/androidx/lifecycle/LiveData<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[getTapToFocusState](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getTapToFocusState())()`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getTapToFocusInfoState()` instead.

<br />

`https://developer.android.com/reference/kotlin/androidx/lifecycle/LiveData<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getTorchState()()`

Returns a `https://developer.android.com/reference/kotlin/androidx/lifecycle/LiveData` of current `https://developer.android.com/reference/kotlin/androidx/camera/core/TorchState`.
`https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getVideoCaptureDynamicRange()()`

Gets the `https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange` for video capture.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getVideoCaptureMirrorMode()()`

Gets the mirror mode for video capture.
`https://developer.android.com/reference/kotlin/androidx/camera/video/QualitySelector` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getVideoCaptureQualitySelector()()`

Returns the `https://developer.android.com/reference/kotlin/androidx/camera/video/QualitySelector` for `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#VIDEO_CAPTURE()`.
`https://developer.android.com/reference/android/util/Range.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getVideoCaptureTargetFrameRate()()`

Gets the target frame rate in frames per second for video capture.
`https://developer.android.com/reference/kotlin/androidx/lifecycle/LiveData<https://developer.android.com/reference/kotlin/androidx/camera/core/ZoomState!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#getZoomState()()`

Returns a `https://developer.android.com/reference/kotlin/androidx/lifecycle/LiveData` of `https://developer.android.com/reference/kotlin/androidx/camera/core/ZoomState`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#hasCamera(androidx.camera.core.CameraSelector)(cameraSelector: https://developer.android.com/reference/kotlin/androidx/camera/core/CameraSelector)`

Checks if the given `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraSelector` can be resolved to a camera.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#isAutoRotationEnabled()()`

Returns whether auto-rotation is enabled.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#isImageAnalysisEnabled()()`

Checks if `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis` is enabled.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#isImageCaptureEnabled()()`

Checks if `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture` is enabled.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#isPinchToZoomEnabled()()`

Returns whether pinch-to-zoom is enabled.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#isRecording()()`

Returns whether there is an in-progress video recording.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#isTapToFocusEnabled()()`

Returns whether tap-to-focus is enabled.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#isVideoCaptureEnabled()()`

Checks if video capture is enabled.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setAutoRotationEnabled(boolean)(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Sets whether to enable auto-rotation.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setCameraSelector(androidx.camera.core.CameraSelector)(cameraSelector: https://developer.android.com/reference/kotlin/androidx/camera/core/CameraSelector)`

Sets the `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraSelector`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setEffects(java.util.Set<androidx.camera.core.CameraEffect>)(effects: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/kotlin/androidx/camera/core/CameraEffect!>)`

Sets `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraEffect`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setEnabledUseCases(int)(enabledUseCases: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Enables or disables use cases.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageAnalysisAnalyzer(java.util.concurrent.Executor,androidx.camera.core.ImageAnalysis.Analyzer)(

executor: https://developer.android.com/reference/java/util/concurrent/Executor.html,

analyzer: https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis.Analyzer

)`

Sets an analyzer to receive and analyze images.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageAnalysisBackgroundExecutor(java.util.concurrent.Executor)(executor: https://developer.android.com/reference/java/util/concurrent/Executor.html?)`

Sets the executor that will be used for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis` background tasks.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageAnalysisBackpressureStrategy(int)(strategy: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the backpressure strategy to apply to the image producer to deal with scenarios where images may be produced faster than they can be analyzed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageAnalysisImageQueueDepth(int)(depth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the image queue depth of `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageAnalysisOutputImageFormat(int)(imageAnalysisOutputImageFormat: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the output image format for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageAnalysisResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)(

resolutionSelector: https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector?

)`

Sets the `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector` for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[setImageAnalysisTargetSize](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageAnalysisTargetSize(androidx.camera.view.CameraController.OutputSize))(targetSize: https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize?)`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageAnalysisResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)` instead.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageCaptureFlashMode(int)(flashMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the flash mode for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageCaptureIoExecutor(java.util.concurrent.Executor)(executor: https://developer.android.com/reference/java/util/concurrent/Executor.html?)`

Sets the default executor that will be used for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture` IO tasks.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageCaptureMode(int)(captureMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the image capture mode.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageCaptureResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)(

resolutionSelector: https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector?

)`

Sets the `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector` for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[setImageCaptureTargetSize](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageCaptureTargetSize(androidx.camera.view.CameraController.OutputSize))(targetSize: https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize?)`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageCaptureResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)` instead.

<br />

`https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/java/lang/Void.html!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setLinearZoom(float)(linearZoom: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`

Sets current zoom by a linear zoom value ranging from 0f to 1.0f.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setPinchToZoomEnabled(boolean)(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Enables/disables pinch-to-zoom.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setPreviewResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)(resolutionSelector: https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector?)`

Sets the `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector` for `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[setPreviewTargetSize](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setPreviewTargetSize(androidx.camera.view.CameraController.OutputSize))(targetSize: https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize?)`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setPreviewResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)` instead.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setSessionConfig(androidx.camera.core.SessionConfig,androidx.camera.core.CameraSelector)(

sessionConfig: https://developer.android.com/reference/kotlin/androidx/camera/core/SessionConfig,

cameraSelector: https://developer.android.com/reference/kotlin/androidx/camera/core/CameraSelector

)`

Sets the `https://developer.android.com/reference/kotlin/androidx/camera/core/SessionConfig` with the `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraSelector` for the CameraController.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setTapToFocusAutoCancelDuration(long,java.util.concurrent.TimeUnit)(

duration: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html,

timeUnit: https://developer.android.com/reference/java/util/concurrent/TimeUnit.html

)`

Sets the auto-cancel duration for tap-to-focus events.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setTapToFocusEnabled(boolean)(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Enables/disables tap-to-focus.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setVideoCaptureDynamicRange(androidx.camera.core.DynamicRange)(dynamicRange: https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange)`

Sets the `https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange` for video capture.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setVideoCaptureMirrorMode(int)(mirrorMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the mirror mode for video capture.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setVideoCaptureQualitySelector(androidx.camera.video.QualitySelector)(qualitySelector: https://developer.android.com/reference/kotlin/androidx/camera/video/QualitySelector)`

Sets the `https://developer.android.com/reference/kotlin/androidx/camera/video/QualitySelector` for `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#VIDEO_CAPTURE()`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setVideoCaptureTargetFrameRate(android.util.Range<java.lang.Integer>)(targetFrameRate: https://developer.android.com/reference/android/util/Range.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>)`

Sets the target frame rate range in frames per second for video capture.
`https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/java/lang/Void.html!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setZoomRatio(float)(zoomRatio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`

Sets current zoom by ratio.
`https://developer.android.com/reference/kotlin/androidx/camera/video/Recording` `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 26)

@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#startRecording(androidx.camera.video.FileDescriptorOutputOptions,androidx.camera.view.video.AudioConfig,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)(

outputOptions: https://developer.android.com/reference/kotlin/androidx/camera/video/FileDescriptorOutputOptions,

audioConfig: https://developer.android.com/reference/kotlin/androidx/camera/view/video/AudioConfig,

executor: https://developer.android.com/reference/java/util/concurrent/Executor.html,

listener: https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://developer.android.com/reference/kotlin/androidx/camera/video/VideoRecordEvent!>

)`

Takes a video to a given file descriptor.
`https://developer.android.com/reference/kotlin/androidx/camera/video/Recording` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#startRecording(androidx.camera.video.FileOutputOptions,androidx.camera.view.video.AudioConfig,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)(

outputOptions: https://developer.android.com/reference/kotlin/androidx/camera/video/FileOutputOptions,

audioConfig: https://developer.android.com/reference/kotlin/androidx/camera/view/video/AudioConfig,

executor: https://developer.android.com/reference/java/util/concurrent/Executor.html,

listener: https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://developer.android.com/reference/kotlin/androidx/camera/video/VideoRecordEvent!>

)`

Takes a video to a given file.
`https://developer.android.com/reference/kotlin/androidx/camera/video/Recording` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#startRecording(androidx.camera.video.MediaStoreOutputOptions,androidx.camera.view.video.AudioConfig,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)(

outputOptions: https://developer.android.com/reference/kotlin/androidx/camera/video/MediaStoreOutputOptions,

audioConfig: https://developer.android.com/reference/kotlin/androidx/camera/view/video/AudioConfig,

executor: https://developer.android.com/reference/java/util/concurrent/Executor.html,

listener: https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://developer.android.com/reference/kotlin/androidx/camera/video/VideoRecordEvent!>

)`

Takes a video to MediaStore.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#takePicture(java.util.concurrent.Executor,androidx.camera.core.ImageCapture.OnImageCapturedCallback)(

executor: https://developer.android.com/reference/java/util/concurrent/Executor.html,

callback: https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture.OnImageCapturedCallback

)`

Captures a new still image for in memory access.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#takePicture(androidx.camera.core.ImageCapture.OutputFileOptions,java.util.concurrent.Executor,androidx.camera.core.ImageCapture.OnImageSavedCallback)(

outputFileOptions: https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture.OutputFileOptions,

executor: https://developer.android.com/reference/java/util/concurrent/Executor.html,

imageSavedCallback: https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture.OnImageSavedCallback

)`

Captures a new still image and saves to a file along with application specified metadata.

## Public constructors

### LifecycleCameraController

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
LifecycleCameraController(context: Context)
```

## Public functions

### bindToLifecycle

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
@MainThread
fun bindToLifecycle(lifecycleOwner: LifecycleOwner): Unit
```

Sets the `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` to be bound with the controller.

The state of the lifecycle will determine when the cameras are open, started, stopped and closed. When the `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner`'s state is start or greater, the controller receives camera data. It stops once the `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` is destroyed.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If the provided camera selector is unable to resolve a camera to be used for the given use cases. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/lifecycle/ProcessCameraProvider#bindToLifecycle(androidx.lifecycle.LifecycleOwner,androidx.camera.core.CameraSelector,androidx.camera.core.UseCase...)` |   |

### unbind

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
@MainThread
fun unbind(): Unit
```

Clears the previously set `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` and stops the camera.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/lifecycle/ProcessCameraProvider#unbindAll()` |   |