getLivePreview

fun getLivePreview(): Flow<Source>

Start live preview as motion JPEG.

Return

You can get the newest frame in a CoroutineScope like this:

getLivePreview()
.conflate()
.collect { frame ->
if (isActive) {
// Read frame
}
frame.close()
}

suspend fun getLivePreview(frameHandler: suspend (Pair<ByteArray, Int>) -> Boolean)

Start live preview as motion JPEG.

Parameters

frameHandler

Called for each JPEG frame. If frameHandler returns false, live preview finishes.

Throws

Command is currently disabled; for example, the camera is shooting a video.