rememberCamera
Use the Camera (the equivalent of VisionCamera's useCamera).
This creates a CameraSession, configures it with the device and outputs whenever they change, starts it while isActive is true, applies the orientationSource's orientation to all outputs, forwards its events to the given callbacks, applies zoom, exposure and torchMode declaratively, and returns the CameraController.
val previewOutput = rememberPreviewOutput()
val controller = rememberCamera(
isActive = true,
device = TargetCameraPosition.BACK,
outputs = listOf(previewOutput),
)
NativePreviewView(previewOutput, Modifier.fillMaxSize())Return
The CameraController, or null while the session is not configured yet.
Parameters
Starts the session when true, and stops it when false.
The me.nathanfallet.visioncamera.CameraDevice to open, or a me.nathanfallet.visioncamera.TargetCameraPosition to use the default device at that position.
The CameraOutputs the device streams into.
Constraints the session tries to match, ranked by priority. Like VisionCamera's useCamera, a ResolutionBiasConstraint for each of the outputs is added after them, with a lower priority.
Whether the outputs are mirrored. MirrorMode.AUTO mirrors selfie cameras.
The OrientationSource whose orientation is automatically applied to all outputs (see CameraOutput.outputOrientation), or null to set it yourself (VisionCamera's 'custom').
The zoom value, applied declaratively.
The exposure bias, applied declaratively.
The torch mode, applied declaratively.
Low-light boost, smooth auto-focus and distortion correction.
Session-wide configuration (iOS audio and haptics behavior).
Called once the constraints have been resolved.
Called whenever the session has been configured.
Called when the session started.
Called when the session stopped.
Called when the session encountered an error.
Called when the session was interrupted.
Called when an interruption ended.
Called when the subject area substantially changes, e.g. when the user pans away from a scene previously in focus: a good point to reset locked focus. iOS only, like V5, see CameraController.addSubjectAreaChangedListener.
Called when the output orientation (driven by orientationSource) or the interface orientation changes, with the rotation in degrees (-90, 0, 90 or 180) that UI elements such as Camera controls need to appear upright.