Document Camera
The Document Camera component provides a live camera interface for capturing identity documents. It includes real-time feedback, auto-capture, and customizable UI elements.
Properties
-
isOpen
:Bool
Starts or stops the camera. Whentrue
, the camera feed and UI are rendered. Automatically set tofalse
after capture or error. -
showToggle
:Bool
Controls visibility of the Auto Capture toggle. Defaults totrue
. -
toggleAutoCaptureDelay
:Int
(ms)
Delay before enabling the Auto Capture toggle after animation completes. -
showBackOfDocumentAnimation
:Bool
Iftrue
, shows back-side animation first. Defaults tofalse
. -
hints
:DocumentDetectionHint
Customizes user guidance messages. Unset fields use defaults. -
successTime
:Int
(ms)
Duration the success screen is shown after capture. Defaults to500
. -
showHelpIcon
:Bool
Controls visibility of the Help icon. Defaults totrue
. -
texts
:Object
Custom text for UI labels:autoCaptureText
autoCaptureOnText
autoCaptureOffText
alertText
-
generalInfoTexts
:[String, String]
First string: smart capture instructions.
Second string: tap-to-capture instructions.
Events
-
OpenEventName
Triggered when the camera starts. -
CloseEventName
Triggered when the camera stops. -
UserCanceledEventName
Triggered when the user clicks the back arrow and exits the document camera without capturing an image. -
FailureEventName
Triggered on error.detail.error
is of typeDocCameraError
. -
CaptureEventName
Triggered on successful capture.detail.captureResponse
contains capture data. -
DetectEventName
Triggered on each frame detection.detail
includesdetectResponse
andcameraState
.
Type Definitions
type DocumentDetectionHint = {
moveCloserHint?: DocumentHint;
fixBlurHint?: DocumentHint;
fixGlareHint?: DocumentHint;
outOfFrameHint?: DocumentHint;
capturingHint?: DocumentHint;
};
type DocumentHint = {
title: string;
description: string;
};
type DocCameraError = {
code: string;
message: string;
};
type CaptureResponse = {
isGood?: boolean;
isSharp?: boolean;
isGlareFree?: boolean;
isAdequateDpi?: boolean;
isPortraitOrientation?: boolean;
failedChecks?: string[];
imageData?: ImageData;
imageWidth?: number;
imageHeight?: number;
};
type DetectResponse = {
isGood: boolean;
isSharp?: boolean;
isGlareFree?: boolean;
isAdequateDpi?: boolean;
failedChecks: string[];
dimensions?: Dimension;
corners?: MappedCorners;
};
type Dimension = {
width: number;
height: number;
};
type MappedCorners = {
topLeft: Corner;
topRight: Corner;
bottomLeft: Corner;
bottomRight: Corner;
};
type Corner = {
x: number;
y: number;
};
enum CameraState {
MoveCloser,
OutOfFrame,
FixGlare,
FixBlur,
Countdown,
Capturing,
TapToCapture
}