Skip to Content
ConceptsCapture lifecycle

Capture session lifecycle

FaceCaptureSession is an EventEmitter with the following shape:

idle → initializing → ready → detecting → hold_steady → capturing → (quality_check) → completed ↘ retry → detecting ↘ error

You call start(). The session opens the camera, runs detection, emits a 'guidance' event on every frame, fires 'captured' when a frame passes the gates, then 'completed'. Call stop() to tear down early.

Events

EventPayload
startednone
state_changeFaceCaptureState
detectionFaceDetectionEvent
guidanceGuidanceState
face_qualityFaceQualityResult
face_quality_failedFaceQualityResult (a retry attempt failed)
face_quality_error{ reason }
capturedface capture result (see note)
completedfinal result
errorSladeIDError subclass
stoppednone

The captured payload is a partial object — { imageBase64, antispoofScore, deviceInfo } — which you pass straight to enrollFace / matchFace / searchFace; the full FaceCaptureResult (including livenessCompleted, challengeResults) is carried by the completed event.

Reading the state

Wire 'guidance' to the UI for prompts (“hold steady”, “move closer”). Wire 'state_change' for higher-level UI changes (showing a countdown, swapping the overlay). Wire 'captured' and 'completed' for the success path; wire 'error' for the failure path.

Used in