# InteropConfigurableScope

Artifact: [androidx.camera:camera-core](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/core/CameraXDsl.kt+class:androidx.camera.core.InteropConfigurableScope) Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

*** ** * ** ***


```
@CameraXDsl
interface InteropConfigurableScope<B : Any?>
```

<br />

Known direct subclasses [ImageAnalysisScope](https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysisScope), [PreviewScope](https://developer.android.com/reference/kotlin/androidx/camera/core/PreviewScope), [VideoCaptureScope](https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCaptureScope)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysisScope` | Scope class for `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysis` configuration DSL. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/PreviewScope` | Scope class for `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview` configuration DSL. |
| `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCaptureScope` | Scope class for `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapture` configuration DSL. |

*** ** * ** ***

Scope for CameraX DSL builders that supports applying interoperability options.

Implemented by CameraX UseCase Kotlin DSL scope classes (such as `https://developer.android.com/reference/kotlin/androidx/camera/core/PreviewScope`, `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageAnalysisScope`, and `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCaptureScope`) to expose their underlying builder for interop extension functions like `camera2Interop { ... }`.

| Parameters |
|---|---|
| `<B : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>` | type of builder configured by this scope |

## Summary

| ### Extension functions |
|---|---|
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `<B : https://developer.android.com/reference/kotlin/androidx/camera/core/UseCase.InteropConfigurable<B>> https://developer.android.com/reference/kotlin/androidx/camera/core/InteropConfigurableScope<B>.https://developer.android.com/reference/kotlin/androidx/camera/core/InteropConfigurableScope#(androidx.camera.core.InteropConfigurableScope).camera2Interop(kotlin.Function1)( crossinline block: https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/UseCaseCamera2Interop.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Applies Camera2 options inside an `https://developer.android.com/reference/kotlin/androidx/camera/core/InteropConfigurableScope` DSL block. |

## Extension functions

### InteropConfigurableScope.camera2Interop

Artifact: [androidx.camera:camera-camera2](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/camera2/interop/Camera2InteropEx.kt+function:camera2Interop)

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

Applies Camera2 options inside an `https://developer.android.com/reference/kotlin/androidx/camera/core/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 `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/package-summary#(androidx.camera.core.ImageCaptureScope).camera2Interop(kotlin.Function1)` extension function.

Options configured via `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/UseCaseCamera2Interop` include:

- Physical camera ID (`https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#physicalCameraId()`)

- Stream use case (`https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#streamUseCase()`)

- Mirror mode (`https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#mirrorMode()`)

- Timestamp base (`https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#timestampBase()`)

- Dynamic range profile (`https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#dynamicRangeProfile()`)

- Surface group ID (`https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#surfaceGroupId()`)

**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.

```kotlin
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: https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/UseCaseCamera2Interop.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | configuration block setting Camera2 options on `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/UseCaseCamera2Interop` |