import { MonkPicture } from '@monkvision/types'; import { CameraHandle } from '@monkvision/camera-web'; /** * Params accepted by the useFrameSelection hook. */ export interface UseFrameSelectionParams { /** * The camera handle. */ handle: CameraHandle; /** * Interval (in milliseconds) at which camera frames should be taken. */ frameSelectionInterval: number; /** * Callback called when a frame has been selected and should be uploaded to the API. */ onFrameSelected?: (picture: MonkPicture) => void; } /** * Handle used to manage the frame selection feature. */ export interface FrameSelectionHandle { /** * The number of frames that have successfully been processed and added to the upload queue. */ processedFrames: number; /** * The total number of frames added to the processing queue. */ totalProcessingFrames: number; /** * Callback called when a video frame should be captured. */ onCaptureVideoFrame: () => void; } /** * Custom hook used to manage the video frame selection. Basically, every time a camera screenshot is taken, it is added * to the frame selection processing queue. The blurriness score of the screenshot is calculated, and the best video * frame (the less blurry one) is always stored in memory. Finally, every `frameSelectionInterval` milliseconds, the * best video frame is "selected" (to be uploaded to the API) and the process resets. */ export declare function useFrameSelection({ handle, frameSelectionInterval, onFrameSelected, }: UseFrameSelectionParams): FrameSelectionHandle;