startCamera

fun startCamera(cameraSettings: MiSnapSettings.Camera, lifecycleOwner: LifecycleOwner? = null, requireTakePictureCapability: Boolean = true, cameraStartedListener: () -> Unit = {})

Starts the camera with the provided configurations. These settings are equivalent to the following attributes in a layout xml file:

app:cameraProfile for the MiSnapSettings.Camera.profile

app:torchEnabled for MiSnapSettings.Camera.TorchMode.ON/MiSnapSettings.Camera.TorchMode.OFF

app:recordingEnabled for the MiSnapSettings.Camera.VideoRecord.recordSession

app:recordAudio for the MiSnapSettings.Camera.VideoRecord.recordAudio

app:videoQuality for the MiSnapSettings.Camera.VideoRecord.videoQuality

app:videoBitrate for the MiSnapSettings.Camera.VideoRecord.videoBitrate

app:videoWidth {@deprecated use videoQuality} for the MiSnapSettings.Camera.VideoRecord.videoResolution's width.

app:videoHeight {@deprecated use videoQuality} for the MiSnapSettings.Camera.VideoRecord.videoResolution's height.

If requireTakePictureCapability is requested, the camera will be configured to allow requests to take manual frames at the expense of the ability to generate images for analysis with a higher resolution than 1080p on supported devices. If it is not requested and the capability is needed later, the camera must be re-initialized.

Parameters

lifecycleOwner

The lifecycle to bind the camera to.

requireTakePictureCapability

Determines whether manual picture-taking capabilities are enabled or disabled.

cameraStartedListener

Optional callback when the camera has finished loading.