ScanbotCameraXView

Constructors

Link copied to clipboard
constructor(context: Context)
constructor(context: Context, attrs: AttributeSet?)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Pinch to Zoom Callback

Properties

Link copied to clipboard
Link copied to clipboard
open override var delayAfterFocusCompleteMs: Long

Delay that camera will took before snap on auto focus complete called from camera core in ms. For some devices this callback could call even before real auto focus completed, so we need to take some delay before snapping. Usually you can set 500ms. By default it is set to 20ms.

Link copied to clipboard
open override var lifecycleOwner: <Error class: unknown class>?

Sets lifecycle owner for camera view. N/A for ScanbotCameraView implementation. Setting null means view will attempt to resolve lifecycle on its own.

Link copied to clipboard

Set whether camera should use the front camera in mirror mode for data detection. Helps with detection of mrz and other ocr related data with front camera. By default, it is set to true.

Link copied to clipboard

TODO: desperately needs documentation!!!

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override var supportedZoomRange: ZoomRange

TODO: desperately needs documentation!!!

Functions

Link copied to clipboard
open override fun addCameraStateCallback(cameraStateCallback: CameraStateCallback)

Adds callback which will be notified about camera state changes. Callbacks are invoked on a main thread.

Link copied to clipboard
open override fun addFrameHandler(frameHandler: FrameHandler)

Used to add FrameHandler that will be called on each next frame.

Link copied to clipboard
open override fun addPictureCallback(pictureCallback: BasePictureCallback)

Adds callback which will be notified when picture will be taken. Callbacks are invoked on a worker thread, so you can safely perform "heavy" operations here.

Link copied to clipboard
open override fun addTakePictureCallback(cameraTakePictureCallback: CameraTakePictureCallback)

Adds callback which will be notified about take picture operation process. Callbacks are invoked on a main thread.

Link copied to clipboard
open override fun autoFocus()

Performs auto-focus.

Link copied to clipboard
open override fun continuousFocus()

Cancels auto-focus and performs continuous-focus. Should be executed from the main thread and when camera is opened

Link copied to clipboard

Stops camera preview stream but leaving detection enabled. Internal Use Only!

Link copied to clipboard
open override fun <T : FrameHandler> getAttachedFrameHandler(clazz: Class<T>): T?

Obtain FrameHandler instance of type clazz, that is attached to the view (if any).

Link copied to clipboard
open override fun isFlashEnabled(): Boolean

Returns the current state of the flashlight Should be executed from the main thread and when camera is opened

Link copied to clipboard
open override fun isSnapAnimationEnabled(enabled: Boolean)

Set whether camera should use snapping animation. By default set to true This parameter works only with ScanbotCameraXView enabled

Link copied to clipboard
open override fun lockMinFocusDistance(lock: Boolean)

Locks the min supported focus distance and disables continuous focus

Link copied to clipboard
open override fun lockToLandscape(lockPicture: Boolean)

Locks camera in landscape mode

Link copied to clipboard
open override fun lockToPortrait(lockPicture: Boolean)

Locks camera in portrait mode

Link copied to clipboard
open override fun removeCameraStateCallback(cameraStateCallback: CameraStateCallback)

Removes callback, so it won't receive any further notifications.

Link copied to clipboard
open override fun removeFrameHandler(frameHandler: FrameHandler)

Unregisters given FrameHandler instance.

Link copied to clipboard
open override fun removePictureCallback(pictureCallback: BasePictureCallback)

Removes callback, so it won't receive any further notifications.

Link copied to clipboard
open override fun removeTakePictureCallback(cameraTakePictureCallback: CameraTakePictureCallback)

Removes callback, so it won't receive any further notifications.

Link copied to clipboard
open override fun restartPreview()

Restarts preview stream.

Link copied to clipboard

Set whether camera analyzer should be enabled or not. By default, the analyzer is enabled.

Link copied to clipboard
open override fun setAnalyzerFpsLimit(fps: Float)

Limit the frame rate of the camera analyzer. By default, the frame rate is set to the maximum possible value.

Link copied to clipboard
fun setAnalyzerFrameSize(frameSize: Size)

Set camera analyzer frame size. Make sure to set the size with the correct orientation.

Link copied to clipboard
open override fun setAutoFocusOnTouch(autoFocusOnTouch: Boolean)
Link copied to clipboard
fun setCameraFrameSize(frameSize: Size)

Set camera preview and analyzer frame size. Make sure to set the size with the correct orientation.

Link copied to clipboard
open override fun setCameraModule(cameraModule: CameraModule)

Defines a camera module. By default is CameraModule.BACK.

Link copied to clipboard
open override fun setCameraOpenCallback(cameraOpenCallback: CameraOpenCallback)

Callback which will be invoked when camera will be opened

Link copied to clipboard
open override fun setCaptureCallback(captureCallback: CaptureCallback?)

Sets the callback which will be notified about the moment of actual image capture.

Link copied to clipboard
open override fun setForceMaxSnappingQuality(enabled: Boolean)

Set whether camera should force maximum possible quality of snapped picture. As a result snapping speed could be significantly slower and result image could be bigger. By default set to false This parameter works only with ScanbotCameraXView enabled

Link copied to clipboard
open override fun setForceMaxSnappingSize(enabled: Boolean)

Set whether camera should force maximum possible size of snapped picture or use maximum size that available with the same aspect ratio as preview By default set to false This parameter works only with ScanbotCameraXView enabled

Link copied to clipboard

Set whether camera should be able to take pictures. By default, the camera is able to take pictures.

Link copied to clipboard
open override fun setPhysicalZoom(zoom: Float)

Allows to set camera physical zoom value, if the value out of range of real camera min and max values it chooses min or max value. Example: camera physical zoom range 1f..5f if we set 6f it will set 5f. Default value is 1f.

Link copied to clipboard
open override fun setPhysicalZoomRange(zoomRange: ZoomRange)

Set custom zoom range. Default value is ZoomRange(0.5f, 100f).

Link copied to clipboard
fun setPictureSize(pictureSize: Size)

Set camera picture size. Make sure to set the size with the correct orientation.

Link copied to clipboard
fun setPreviewFrameSize(frameSize: Size)

Set camera preview frame size. Make sure to set the size with the correct orientation.

Link copied to clipboard
open override fun setPreviewMode(previewMode: CameraPreviewMode)

Set the camera preview mode. By default - CameraPreviewMode.FILL_IN.

Link copied to clipboard
fun setPreviewRotation(rotation: Int)

Set camera preview frame rotation. Rotation is one of four valid values: Surface.ROTATION_0, Surface.ROTATION_90, Surface.ROTATION_180, Surface.ROTATION_270. Rotation values are relative to the "natural" rotation, Surface.ROTATION_0. By default, the camera preview frame rotation is same as display rotation.

Link copied to clipboard
open override fun setShutterSound(value: Boolean)

Set camera shutter sound state. true if system sound should be played on the take picture event, false - otherwise. By default, the camera plays the system-defined camera shutter sound when takePicture() is called.

Link copied to clipboard
open override fun setSnappingAutoAdjustment(enabled: Boolean)

Set whether camera should automatically adjusts the final image with the surrounding scenery. For example, the vendor library implementation might do low-light detection and switch to low-light mode or HDR to take the picture. Alternatively, the face retouch mode could be automatically applied when taking a portrait image. This delegates modes to the vendor library implementation to decide.

Link copied to clipboard
open override fun setUiZoomLevel(zoomLevel: Float)

Passes the zoom value to the dependent view

Link copied to clipboard
open override fun startPreview()

Starts/resumes camera preview stream. Usually used after picture was taken. Note, the preview is started by default only once after the view is attached, so it's required to call it if the preview was stopped and the view was not reattached.

Link copied to clipboard
open override fun stopPreview()

Stops camera preview stream.

Link copied to clipboard
open override fun takePicture(acquireFocus: Boolean)
open override fun takePicture(acquireFocus: Boolean, isCapturedAutomatically: Boolean)

Takes picture.

Link copied to clipboard

Resume camera preview stream after the freeze. Internal Use Only!

Link copied to clipboard
open override fun unlockOrientation()

Unlocks camera orientation

Link copied to clipboard
open override fun useFlash(useFlash: Boolean)

Enables or disables camera flash.

Link copied to clipboard
open override fun usePinchToZoom(usePinchToZoom: Boolean)

Enables/disables Pinch-to-Zoom camera functionality