Face Camera
The Face Camera component provides a live face capture experience with real-time feedback, automatic capture, and development/production modes.
Properties
-
isOpen
:Bool
Starts or stops the camera. Automatically set tofalse
after capture or error. -
hints
:FaceDetectionHint
Customizes user guidance messages. Unset fields use defaults. -
detectionState
:FaceDetectionState
(read-only)
Indicates the current detection state. Useful for custom UI logic. -
isInPreview
:Bool
(read-only)
Indicates whether the component is currently showing a captured image preview. -
environment
:String
Defines the mode of operation:"production"
(default): Standard secure mode."development"
: Enables debugging and relaxed protections.
-
initializationTimeoutDuration
:Number
(milliseconds)
Defines how long the component will wait for the initialization process to complete before throwing a timeout error. This property defaults to30000
(30 seconds). If theInitializeEventName
event is not dispatched within this duration, a timeout error will be raised, and the camera will fail to start.-
Events
-
BeforeInitializeEventName
Triggered when the component is about to initialize, before any internal models are loaded or live feedback is available. This event allows for setup actions, such as starting timers or preparing UI state, before initialization is complete. -
InitializeEventName
Triggered when the component is initialized and ready. -
BeforeOpenEventName
Triggered when the camera begins to open. -
OpenEventName
Triggered when the camera is fully open. -
DetectEventName
Triggered on each detection.detail.errors
contains an array of detection issues (if any). -
BeforeCaptureEventName
Triggered when the capture process begins. -
CaptureEventName
Triggered on successful capture.detail
includes:imageBase64
: Base64-encoded image string.encryptedFile
: EncryptedBlob
for verification.
-
CloseEventName
Triggered when the camera closes. -
UserCanceledEventName
Triggered when the user taps the back arrow to exit the camera without capturing an image. -
FailureEventName
Triggered on error.detail.error
is of typeFaceCameraError
.
Deprecated Events:
DetectorInitializeEventName
PreviewEventName
RetakeEventName
These are still supported but will be removed in future versions.
Type Definitions
type FaceDetectionHint = {
notInitializedHint?: string;
initializingHint?: string;
faceNotFoundHint?: string;
tooManyFacesHint?: string;
faceAngleTooLargeHint?: string;
probabilityTooSmallHint?: string;
faceTooSmallHint?: string;
faceCloseToBorderHint?: string;
};
enum FaceDetectionState {
NotInitialized = 'NOT_INITIALIZED',
Initializing = 'INITIALIZING',
FaceNotFound = 'FACE_NOT_FOUND',
TooManyFaces = 'TOO_MANY_FACES',
FaceAngleTooLarge = 'FACE_ANGLE_TOO_LARGE',
ProbabilityTooSmall = 'PROBABILITY_TOO_SMALL',
FaceTooSmall = 'FACE_TOO_SMALL',
FaceCloseToBorder = 'FACE_CLOSE_TO_BORDER',
}
type FaceCameraError = {
code: number;
message: string;
};
type FaceDetectionHint = {
notInitializedHint?: string;
initializingHint?: string;
faceNotFoundHint?: string;
tooManyFacesHint?: string;
faceAngleTooLargeHint?: string;
probabilityTooSmallHint?: string;
faceTooSmallHint?: string;
faceCloseToBorderHint?: string;
};
enum FaceDetectionState {
NotInitialized = 'NOT_INITIALIZED',
Initializing = 'INITIALIZING',
FaceNotFound = 'FACE_NOT_FOUND',
TooManyFaces = 'TOO_MANY_FACES',
FaceAngleTooLarge = 'FACE_ANGLE_TOO_LARGE',
ProbabilityTooSmall = 'PROBABILITY_TOO_SMALL',
FaceTooSmall = 'FACE_TOO_SMALL',
FaceCloseToBorder = 'FACE_CLOSE_TO_BORDER',
}
type FaceCameraError = {
code: number;
message: string;
};