import type { Body, DefinePluginOpts, Meta, MinimalRequiredUppyFile, PluginTarget, UIPluginOptions, Uppy } from '@uppy/core'; import { UIPlugin } from '@uppy/core'; import type { LocaleStrings } from '@uppy/utils'; import { type ComponentChild } from 'preact'; import locale from './locale.js'; export type WebcamStatus = 'init' | 'ready' | 'recording' | 'captured' | 'error'; export interface WebcamOptions extends UIPluginOptions { target?: PluginTarget; onBeforeSnapshot?: () => Promise; countdown?: number | false; modes?: Array<'video-audio' | 'video-only' | 'audio-only' | 'picture'>; mirror?: boolean; showVideoSourceDropdown?: boolean; videoConstraints?: MediaTrackConstraints; showRecordingLength?: boolean; preferredImageMimeType?: string | null; preferredVideoMimeType?: string | null; mobileNativeCamera?: boolean; locale?: LocaleStrings; } export interface WebcamState { hasCamera: boolean; cameraReady: boolean; cameraError: null | Error; recordingLengthSeconds: number; videoSources: MediaDeviceInfo[]; currentDeviceId: string | MediaStreamTrack | null | undefined; recordedVideo: null | string; capturedSnapshot: null | string; isRecording: boolean; [key: string]: unknown; } export declare const defaultOptions: { onBeforeSnapshot: () => Promise; countdown: false; modes: any; mirror: true; showVideoSourceDropdown: false; preferredImageMimeType: null; preferredVideoMimeType: null; showRecordingLength: false; mobileNativeCamera: boolean; }; /** * Webcam */ export default class Webcam extends UIPlugin, keyof typeof defaultOptions>, M, B, WebcamState> { #private; static VERSION: string; private mediaDevices; private supportsUserMedia; private protocol; private capturedMediaFile; private icon; webcamActive: boolean; stream: MediaStream | null; private recorder; private recordingChunks; private recordingLengthTimer?; private captureInProgress; constructor(uppy: Uppy, opts?: WebcamOptions); getStatus(): WebcamStatus; setOptions(newOpts: Partial>): void; hasCameraCheck(): Promise; isAudioOnly(): boolean; getConstraints(deviceId?: string | null): { video: false | MediaTrackConstraints; audio: boolean; }; start(options?: { deviceId: string; } | null): Promise | undefined; getMediaRecorderOptions(): { mimeType?: string; }; startRecording(): void; stopRecording(): Promise; discardRecordedMedia(): void; submit(): void; stop(): Promise; getVideoElement(): HTMLVideoElement | null; oneTwoThreeSmile(): Promise; takeSnapshot(): Promise; getImage(): Promise>; getVideo(): Promise>; focus(): void; changeVideoSource(deviceId: string): void; updateVideoSources(): void; render(): ComponentChild; install(): void; uninstall(): void; onUnmount(): void; } //# sourceMappingURL=Webcam.d.ts.map