class CameraView
data class SavedState |
CameraView(context: <ERROR CLASS>, attrs: <ERROR CLASS>? = null, defStyleAttr: Int = 0) |
var adjustViewBounds: Boolean
True when this CameraView is adjusting its bounds to preserve the aspect ratio of camera. |
|
var aspectRatio: AspectRatio
Current aspect ratio of camera. Valid format is "height:width" eg. "4:3". |
|
var autoFocus: Boolean
|
|
var awb: Int
Current auto white balance mode. Supported values Modes.AutoWhiteBalance. |
|
var cameraMode: Int
The mode in which camera starts. Supported values Modes.CameraMode. |
|
var facing: Int
Direction that the current camera faces. Supported values are Modes.Facing.FACING_BACK and Modes.Facing.FACING_FRONT. |
|
var flash: Int
Current flash mode. Supported values Modes.Flash. |
|
val isCameraOpened: Boolean
|
|
var noiseReduction: Int
Current noise reduction mode. Supported values Modes.NoiseReduction. |
|
var opticalStabilization: Boolean
Current optical stabilization mode |
|
var outputFormat: Int
Format of the output of image data produced from the camera. Supported values Modes.OutputFormat. |
|
var shutter: Int
Current shutter time in milliseconds. Supported values Modes.Shutter. |
|
val supportedAspectRatios: Set<AspectRatio>
Gets all the aspect ratios supported by the current camera. |
|
var zsl: Boolean
Zero shutter lag mode capture. |
fun addCameraClosedListener(listener: () -> Unit): CameraView
Add a new camera closed listener. |
|
fun addCameraErrorListener(listener: (t: Throwable) -> Unit): CameraView
Add a new camera error listener. |
|
fun addCameraOpenedListener(listener: () -> Unit): CameraView
Add a new camera opened listener. |
|
fun addPictureTakenListener(listener: (imageData: ByteArray) -> Unit): CameraView
Add a new picture taken listener. |
|
fun capture(): Unit
Take a picture. The result will be returned to listeners added by addPictureTakenListener. |
|
fun onAttachedToWindow(): Unit |
|
fun onDetachedFromWindow(): Unit |
|
fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int): Unit |
|
fun onRestoreInstanceState(state: <ERROR CLASS>?): Unit |
|
fun onSaveInstanceState(): <ERROR CLASS>? |
|
fun pauseVideoRecording(): Boolean
Pause video recording |
|
fun removeAllListeners(): Unit
Remove all listeners previously set. |
|
fun removeCameraClosedListener(listener: () -> Unit): CameraView
Remove camera closed listener. |
|
fun removeCameraErrorListener(listener: (Throwable) -> Unit): CameraView
Remove camera error listener. |
|
fun removeCameraOpenedListener(listener: () -> Unit): CameraView
Remove camera opened listener. |
|
fun removePictureTakenListener(listener: (ByteArray) -> Unit): CameraView
Remove picture taken listener. |
|
fun removePreviewFrameListener(): CameraView
Remove preview frame listener. |
|
fun resumeVideoRecording(): Boolean
Resume video recording |
|
fun setPreviewFrameListener(listener: (<ERROR CLASS>) -> Unit): CameraView
Set preview frame listener. Be careful while using this listener as it is invoked on each frame, which could be 60 times per second if frame rate is 60 fps. Ideally you should only process next frame once you are done processing previous frame. Don't continuously launch background tasks for each frame, it is not memory efficient, the device will run out of memory very quickly and force close the app. |
|
fun start(): Unit
Open a camera device and start showing camera preview. This is typically called from Activity.onResume. |
|
fun startVideoRecording(outputFile: File): Unit
Start capturing video. |
|
fun stop(removeAllListeners: Boolean = false): Unit
Stop camera preview and close the device. This is typically called from Activity.onPause. |
|
fun stopVideoRecording(): Boolean
Stop video recording |