getLivePreview

fun getLivePreview(): Flow<ByteReadPacket>

Start live preview as motion JPEG.

Return

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

getLivePreview()
.conflate()
.collect { byteReadPacket ->
if (isActive) {
// Read byteReadPacket
}
byteReadPacket.release()
}

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.