InteropConfigurableScope


@CameraXDsl
interface InteropConfigurableScope<B : Any?>

Known direct subclasses
ImageAnalysisScope

Scope class for ImageAnalysis configuration DSL.

PreviewScope

Scope class for Preview configuration DSL.

VideoCaptureScope

Scope class for VideoCapture configuration DSL.


Scope for CameraX DSL builders that supports applying interoperability options.

Implemented by CameraX UseCase Kotlin DSL scope classes (such as PreviewScope, ImageAnalysisScope, and androidx.camera.video.VideoCaptureScope) to expose their underlying builder for interop extension functions like camera2Interop { ... }.

Parameters
<B : Any?>

type of builder configured by this scope

Summary

Extension functions

inline Unit

Applies Camera2 options inside an InteropConfigurableScope DSL block.

Extension functions

InteropConfigurableScope.camera2Interop

inline fun <B : UseCase.InteropConfigurable<B>> InteropConfigurableScope<B>.camera2Interop(
    crossinline block: UseCaseCamera2Interop.() -> Unit
): Unit

Applies Camera2 options inside an InteropConfigurableScope DSL block.

Configures Camera2 options on the underlying UseCase builder within Kotlin DSL blocks such as preview { ... }, imageAnalysis { ... }, or videoCapture { ... }. For imageCapture { ... }, use the dedicated ImageCaptureScope.camera2Interop extension function.

Options configured via UseCaseCamera2Interop include:

Note: Using Camera2 interop options can override internal CameraX configurations. If an option configured via interop conflicts with options required by CameraX internally, the option from Camera2Interop will override, which may result in unexpected behavior.

import androidx.camera.camera2.interop.camera2Interop
import androidx.camera.core.preview

val preview = preview {
    camera2Interop {
        physicalCameraId = "0"
        mirrorMode = OutputConfiguration.MIRROR_MODE_H
    }
}
Parameters
crossinline block: UseCaseCamera2Interop.() -> Unit

configuration block setting Camera2 options on UseCaseCamera2Interop