CameraPreview

fun CameraPreview(modifier: Modifier = Modifier, cameraState: CameraState = rememberCameraState(), camSelector: CamSelector = cameraState.camSelector, captureMode: CaptureMode = cameraState.captureMode, imageCaptureMode: ImageCaptureMode = cameraState.imageCaptureMode, imageCaptureTargetSize: ImageTargetSize? = cameraState.imageCaptureTargetSize, flashMode: FlashMode = cameraState.flashMode, scaleType: ScaleType = cameraState.scaleType, enableTorch: Boolean = cameraState.enableTorch, exposureCompensation: Int = cameraState.initialExposure, zoomRatio: Float = 1.0f, imageAnalyzer: ImageAnalyzer? = null, implementationMode: ImplementationMode = cameraState.implementationMode, isImageAnalysisEnabled: Boolean = cameraState.isImageAnalysisEnabled, isFocusOnTapEnabled: Boolean = cameraState.isFocusOnTapEnabled, isPinchToZoomEnabled: Boolean = cameraState.isZoomSupported, videoQualitySelector: QualitySelector = cameraState.videoQualitySelector, onPreviewStreamChanged: () -> Unit = {}, onSwitchToFront: @Composable (Bitmap) -> Unit = {}, onSwitchToBack: @Composable (Bitmap) -> Unit = {}, onFocus: suspend (onComplete: () -> Unit) -> Unit = { onComplete -> delay(1000L) onComplete() }, onZoomRatioChanged: (Float) -> Unit = {}, focusTapContent: @Composable () -> Unit = { SquareCornerFocus() }, content: @Composable () -> Unit = {})

Creates a Camera Preview's composable.

Parameters

cameraState

camera state hold some states and camera's controller, it can be useful to given action like CameraState.takePicture

camSelector

camera selector to be added, default is back

captureMode

camera capture mode, default is image

imageCaptureMode

camera image capture mode, default is minimum latency for better performance

imageCaptureTargetSize

suggested target size for image camera capture, default is camera's preferred size

flashMode

flash mode to be added, default is off

scaleType

scale type to be added, default is fill center

enableTorch

enable torch from camera, default is false.

exposureCompensation

camera exposure compensation to be added

zoomRatio

zoom ratio to be added, default is 1.0

imageAnalyzer

image analyzer from camera, see ImageAnalyzer

implementationMode

implementation mode to be added, default is performance

isImageAnalysisEnabled

enable or disable image analysis

isFocusOnTapEnabled

turn on feature focus on tap if true

isPinchToZoomEnabled

turn on feature pinch to zoom if true

videoQualitySelector

quality selector to the video capture

onPreviewStreamChanged

dispatch when preview is switching to front or back

onSwitchToFront

composable preview when change camera to front and it's not been streaming yet

onSwitchToBack

composable preview when change camera to back and it's not been streaming yet

onZoomRatioChanged

dispatch when zoom is changed by pinch to zoom

focusTapContent

content of focus tap, default is SquareCornerFocus

onFocus

callback to use when on focus tap is triggered, call onComplete to focusTapContent gone.

content

content composable within of camera preview.

See also