UNPKG

@face-auth/face-id-video

Version:

Utility library for capturing photos from webcam video streams in the browser. Handles camera selection, image formatting, and output for face authentication APIs.

38 lines (37 loc) 1.11 kB
import { CameraOptions } from "./types/CameraOptions"; import { CaptureOptions } from "./types/CaptureOptions"; import { CaptureResult } from "./types/CaptureResult"; export declare class FaceVideo { private cameraManager; private photoManager; private onCameraStartedCallbacks; constructor(video: HTMLVideoElement); /** * Get all video input devices. */ getDevices(): Promise<MediaDeviceInfo[]>; /** * Start video stream with optional deviceId. */ start(options?: CameraOptions, deviceId?: string): Promise<void>; /** * Stop the video stream and clean up. */ stop(): void; /** * Capture the current frame and return it as Blob. */ capture(options: CaptureOptions): Promise<CaptureResult>; /** * Subscribe to the camera started event. */ onCameraStarted(callback: () => void): void; /** * Unsubscribe from the camera started event. */ offCameraStarted(callback: () => void): void; /** * Internal method to notify all subscribers. */ private emitCameraStarted; }