SessionConfigScope


@CameraXDsl
public final class SessionConfigScope


Scope class for SessionConfig configuration DSL.

Summary

Public methods

final @NonNull List<@NonNull CameraEffect>

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

final @NonNull Range<@NonNull Integer>

The desired frame rate range for the camera session.

final @NonNull List<@NonNull GroupableFeature>

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

final @NonNull Set<@NonNull GroupableFeature>

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

final @Nullable ViewPort

The ViewPort to be applied on the camera session.

final boolean

Whether to use auto rotation.

final void
setAutoRotationEnabled(boolean value)

Whether to use auto rotation.

final void

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

final void

The desired frame rate range for the camera session.

final void

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

final void

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

final void

The ViewPort to be applied on the camera session.

Extension functions

final void

Applies Camera2 options inside a SessionConfigScope DSL block.

Public methods

getEffects

Added in 1.7.0-rc01
public final @NonNull List<@NonNull CameraEffect> getEffects()

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

getFrameRateRange

Added in 1.7.0-rc01
public final @NonNull Range<@NonNull Integer> getFrameRateRange()

The desired frame rate range for the camera session.

getPreferredFeatureGroup

Added in 1.7.0-rc01
public final @NonNull List<@NonNull GroupableFeature> getPreferredFeatureGroup()

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

getRequiredFeatureGroup

Added in 1.7.0-rc01
public final @NonNull Set<@NonNull GroupableFeature> getRequiredFeatureGroup()

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

getViewPort

Added in 1.7.0-rc01
public final @Nullable ViewPort getViewPort()

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

isAutoRotationEnabled

Added in 1.7.0-rc01
public final boolean isAutoRotationEnabled()

Whether to use auto rotation.

setAutoRotationEnabled

Added in 1.7.0-rc01
public final void setAutoRotationEnabled(boolean value)

Whether to use auto rotation.

setEffects

public final void setEffects(@NonNull List<@NonNull CameraEffect> value)

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

setFrameRateRange

Added in 1.7.0-rc01
public final void setFrameRateRange(@NonNull Range<@NonNull Integer> value)

The desired frame rate range for the camera session.

setPreferredFeatureGroup

public final void setPreferredFeatureGroup(@NonNull List<@NonNull GroupableFeature> value)

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

setRequiredFeatureGroup

public final void setRequiredFeatureGroup(@NonNull Set<@NonNull GroupableFeature> value)

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

setViewPort

Added in 1.7.0-rc01
public final void setViewPort(ViewPort value)

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

Camera2InteropEx.camera2Interop

public final void Camera2InteropEx.camera2Interop(
    @NonNull SessionConfigScope receiver,
    @NonNull Function1<@NonNull SessionConfigCamera2Interop, Unit> block
)

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
@NonNull Function1<@NonNull SessionConfigCamera2Interop, Unit> block

configuration block setting Camera2 options on SessionConfigCamera2Interop