# InteropConfigurableScope

Artifact: [androidx.camera:camera-core](https://developer.android.com/jetpack/androidx/releases/camera.md.txt) [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.md.txt#1.7.0-rc02)

*** ** * ** ***


```
@CameraXDsl
public interface InteropConfigurableScope<B extends Object>
```

<br />

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

|---|---|
| `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 extends Object>` | type of builder configured by this scope |

## Summary

| ### Extension functions |
|---|---|
| `default final void` | `<B extends UseCase.InteropConfigurable<@NonNull B>> Camera2InteropEx.camera2Interop( @NonNull InteropConfigurableScope<@NonNull B> receiver, @NonNull Function1<@NonNull UseCaseCamera2Interop, Unit> block )` Applies Camera2 options inside an `InteropConfigurableScope` DSL block. |

## Extension functions

### Camera2InteropEx.camera2Interop

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

```
default final void <B extends UseCase.InteropConfigurable<@NonNull B>> Camera2InteropEx.camera2Interop(
    @NonNull InteropConfigurableScope<@NonNull B> receiver,
    @NonNull Function1<@NonNull UseCaseCamera2Interop, Unit> block
)
```

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:

- Physical camera ID (`UseCaseCamera2Interop.physicalCameraId`)

- Stream use case (`UseCaseCamera2Interop.streamUseCase`)

- Mirror mode (`UseCaseCamera2Interop.mirrorMode`)

- Timestamp base (`UseCaseCamera2Interop.timestampBase`)

- Dynamic range profile (`UseCaseCamera2Interop.dynamicRangeProfile`)

- Surface group ID (`UseCaseCamera2Interop.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 |
|---|---|
| `@NonNull Function1<@NonNull UseCaseCamera2Interop, Unit> block` | configuration block setting Camera2 options on `UseCaseCamera2Interop` |