SessionConfigScope


@CameraXDsl
class SessionConfigScope


Scope class for SessionConfig configuration DSL.

Summary

Public properties

List<CameraEffect>

The list of CameraEffect to be applied on the camera session.

Range<Int>

The desired frame rate range for the camera session.

Boolean

Whether to use auto rotation.

List<GroupableFeature>

The list of preferred GroupableFeature, ordered by priority in descending order.

Set<GroupableFeature>

The set of GroupableFeature that are mandatory for the camera configuration.

ViewPort?

The ViewPort to be applied on the camera session.

Extension functions

inline Unit

Applies Camera2 options inside a SessionConfigScope DSL block.

Public properties

effects

Added in 1.7.0-rc01
var effects: List<CameraEffect>

The list of CameraEffect to be applied on the camera session.

frameRateRange

Added in 1.7.0-rc01
var frameRateRange: Range<Int>

The desired frame rate range for the camera session.

isAutoRotationEnabled

Added in 1.7.0-rc01
var isAutoRotationEnabled: Boolean

Whether to use auto rotation.

preferredFeatureGroup

Added in 1.7.0-rc01
var preferredFeatureGroup: List<GroupableFeature>

The list of preferred GroupableFeature, ordered by priority in descending order.

requiredFeatureGroup

Added in 1.7.0-rc01
var requiredFeatureGroup: Set<GroupableFeature>

The set of GroupableFeature that are mandatory for the camera configuration.

viewPort

Added in 1.7.0-rc01
var viewPort: ViewPort?

The ViewPort to be applied on the camera session.

Note: Setting this property to null is a no-op on the underlying SessionConfig.Builder because SessionConfig.Builder.setViewPort requires a non-null ViewPort.

See also
setViewPort

Extension functions

SessionConfigScope.camera2Interop

inline fun SessionConfigScope.camera2Interop(crossinline block: SessionConfigCamera2Interop.() -> Unit): Unit

Applies Camera2 options inside a SessionConfigScope DSL block.

Configures Camera2 options on the underlying SessionConfig.Builder within a sessionConfig { ... } DSL block.

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

val sessionConfig =
    sessionConfig(listOf(preview)) {
        camera2Interop {
            colorSpace = ColorSpace.Named.DISPLAY_P3
            sessionParameter[CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE] = Range(60, 60)
            captureRequest[CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE] = Range(60, 60)
            repeatingCaptureRequestTemplate = CameraDevice.TEMPLATE_PREVIEW
            repeatingCaptureCallback = object : CameraCaptureSession.CaptureCallback() {}
        }
    }
Parameters
crossinline block: SessionConfigCamera2Interop.() -> Unit

configuration block setting Camera2 options on SessionConfigCamera2Interop