Package-level declarations

Types

Link copied to clipboard

A reference to a Camera, exposing its controller and preview methods (the equivalent of a ref on VisionCamera's <Camera />). Create it with rememberCameraRef and pass it to Camera.

Link copied to clipboard

The state of a Camera or Microphone permission, as returned by rememberCameraPermission or rememberMicrophonePermission.

Link copied to clipboard

A reference to a NativePreviewView, giving access to its methods (the equivalent of a ref on VisionCamera's <NativePreviewView />). Create it with rememberPreviewViewRef and pass it to NativePreviewView.

Functions

Link copied to clipboard
fun Camera(device: CameraDeviceOrPosition, isActive: Boolean, modifier: Modifier = Modifier, outputs: List<CameraOutput> = emptyList(), constraints: List<Constraint> = emptyList(), mirrorMode: MirrorMode = MirrorMode.AUTO, orientationSource: OrientationSource? = OrientationSource.DEVICE, zoom: Double? = null, exposure: Double? = null, torchMode: TorchMode? = null, controllerConfiguration: CameraControllerConfiguration = CameraControllerConfiguration(), sessionConfiguration: CameraSessionConfiguration = CameraSessionConfiguration(), resizeMode: PreviewResizeMode = PreviewResizeMode.COVER, implementationMode: PreviewImplementationMode = PreviewImplementationMode.PERFORMANCE, onControllerChanged: (CameraController?) -> Unit? = null, onSessionConfigSelected: (CameraSessionConfig) -> Unit? = null, onConfigured: () -> Unit? = null, onStarted: () -> Unit? = null, onStopped: () -> Unit? = null, onError: (Throwable) -> Unit = { println("VisionCamera error: $it") }, onInterruptionStarted: (InterruptionReason) -> Unit? = null, onInterruptionEnded: () -> Unit? = null, onSubjectAreaChanged: () -> Unit? = null, onUIRotationChanged: (rotation: Int) -> Unit? = null, onPreviewStarted: () -> Unit? = null, onPreviewStopped: () -> Unit? = null, enableNativeZoomGesture: Boolean = false, enableNativeTapToFocusGesture: Boolean = false, ref: CameraRef? = null)

A Camera view (the equivalent of VisionCamera's <Camera />): it creates a preview output, runs a session with it and the given outputs (see rememberCamera), and displays the preview.

Link copied to clipboard
actual fun NativeFrameRendererView(renderer: FrameRenderer?, modifier: Modifier)

Displays the Frames of a FrameRenderer in an Android FrameRendererView, see the common declaration.

expect fun NativeFrameRendererView(renderer: FrameRenderer?, modifier: Modifier = Modifier)

Displays the me.nathanfallet.visioncamera.Frames rendered by a FrameRenderer, using the platform's native view (me.nathanfallet.visioncamera.FrameRendererView, an Android SurfaceView or an iOS UIView). The equivalent of VisionCamera's <NativeFrameRendererView />.

actual fun NativeFrameRendererView(renderer: FrameRenderer?, modifier: Modifier)

Displays the Frames of a FrameRenderer in an iOS FrameRendererView, see the common declaration.

Link copied to clipboard
actual fun NativePreviewView(previewOutput: CameraPreviewOutput?, modifier: Modifier, resizeMode: PreviewResizeMode, implementationMode: PreviewImplementationMode, gestureControllers: List<GestureController>, ref: PreviewViewRef?, onPreviewStarted: () -> Unit?, onPreviewStopped: () -> Unit?)

Displays the Camera feed in a CameraX-backed Android PreviewView, see the common declaration.

expect fun NativePreviewView(previewOutput: CameraPreviewOutput?, modifier: Modifier = Modifier, resizeMode: PreviewResizeMode = PreviewResizeMode.COVER, implementationMode: PreviewImplementationMode = PreviewImplementationMode.PERFORMANCE, gestureControllers: List<GestureController> = emptyList(), ref: PreviewViewRef? = null, onPreviewStarted: () -> Unit? = null, onPreviewStopped: () -> Unit? = null)

Displays the Camera feed of a CameraPreviewOutput, using the platform's native preview view (me.nathanfallet.visioncamera.PreviewView, an Android View or an iOS UIView).

actual fun NativePreviewView(previewOutput: CameraPreviewOutput?, modifier: Modifier, resizeMode: PreviewResizeMode, implementationMode: PreviewImplementationMode, gestureControllers: List<GestureController>, ref: PreviewViewRef?, onPreviewStarted: () -> Unit?, onPreviewStopped: () -> Unit?)

Displays the Camera feed in an AVFoundation-backed iOS PreviewView, see the common declaration.

Link copied to clipboard
fun rememberCamera(isActive: Boolean, device: CameraDeviceOrPosition, outputs: List<CameraOutput> = emptyList(), constraints: List<Constraint> = emptyList(), mirrorMode: MirrorMode = MirrorMode.AUTO, orientationSource: OrientationSource? = OrientationSource.DEVICE, zoom: Double? = null, exposure: Double? = null, torchMode: TorchMode? = null, controllerConfiguration: CameraControllerConfiguration = CameraControllerConfiguration(), sessionConfiguration: CameraSessionConfiguration = CameraSessionConfiguration(), onSessionConfigSelected: (CameraSessionConfig) -> Unit? = null, onConfigured: () -> Unit? = null, onStarted: () -> Unit? = null, onStopped: () -> Unit? = null, onError: (Throwable) -> Unit = { println("VisionCamera error: $it") }, onInterruptionStarted: (InterruptionReason) -> Unit? = null, onInterruptionEnded: () -> Unit? = null, onSubjectAreaChanged: () -> Unit? = null, onUIRotationChanged: (rotation: Int) -> Unit? = null): CameraController?

Use the Camera (the equivalent of VisionCamera's useCamera).

Link copied to clipboard

Get the CameraDevice that best satisfies the given filter at the given position, or the default CameraDevice at that position if no filter is given. It updates when devices change.

Link copied to clipboard

Get a list of all available CameraExtensions for this specific device (the equivalent of VisionCamera's useCameraDeviceExtensions). It is empty while loading, or if device is null.

Link copied to clipboard

Get the CameraDeviceFactory, or null while it is still loading.

Link copied to clipboard

Get a list of all CameraDevices. It updates when devices change (e.g. a USB Camera is plugged in).

Link copied to clipboard

Use the Camera permission. The status is refreshed every time the app is resumed.

Link copied to clipboard

Create a CameraRef, kept across recompositions.

Link copied to clipboard
fun rememberDepthOutput(options: DepthFrameOutputOptions = DepthFrameOutputOptions(), onDepthFrameDropped: (reason: FrameDroppedReason) -> Unit? = null, onDepth: (depth: Depth) -> Unit?): CameraDepthFrameOutput

Create a CameraDepthFrameOutput with the given options, kept across recompositions and recreated when the options change (the equivalent of VisionCamera's useDepthOutput).

Link copied to clipboard
fun rememberFrameOutput(options: FrameOutputOptions = FrameOutputOptions(), onFrameDropped: (reason: FrameDroppedReason) -> Unit? = null, onFrame: (frame: Frame) -> Unit?): CameraFrameOutput

Create a CameraFrameOutput with the given options, kept across recompositions and recreated when the options change (the equivalent of VisionCamera's useFrameOutput).

Link copied to clipboard

Create a FrameRenderer, kept across recompositions (the equivalent of VisionCamera's useFrameRenderer).

Link copied to clipboard
fun rememberGestureControllers(controller: CameraController?, enableNativeTapToFocusGesture: Boolean, enableNativeZoomGesture: Boolean): List<GestureController>

Create the native GestureControllers to attach to a NativePreviewView, and keep them bound to the given controller. Camera does it for you with enableNativeTapToFocusGesture and enableNativeZoomGesture.

Link copied to clipboard

Use the Microphone permission. The status is refreshed every time the app is resumed.

Link copied to clipboard

Create a CameraObjectOutput scanning the given types, kept across recompositions and recreated when the types change (the equivalent of VisionCamera's useObjectOutput). iOS only.

Link copied to clipboard

The current CameraOrientation of the given source, updated on every change, or null if it is not known yet or source is null (the equivalent of VisionCamera's useOrientation).

Link copied to clipboard

Create a CameraPhotoOutput with the given options, kept across recompositions and recreated when the options change (the equivalent of VisionCamera's usePhotoOutput).

Link copied to clipboard

Create a CameraPreviewOutput, kept across recompositions. Display it with NativePreviewView.

Link copied to clipboard

Create a PreviewViewRef, kept across recompositions.

Link copied to clipboard

Create a CameraVideoOutput with the given options, kept across recompositions and recreated when the options change (the equivalent of VisionCamera's useVideoOutput).