UNPKG

ngx-cam-shoot

Version:

An angular component to use you device's cameras easily. Obtain and save images faster. Thought to use on mobile devices.

128 lines (127 loc) 4.28 kB
import { ElementRef, EventEmitter, SimpleChanges } from '@angular/core'; import { FormControl } from '@angular/forms'; import * as i0 from "@angular/core"; export declare enum eCamShootType { DEFAULT = "DEFAULT", SELFIE = "SELFIE", DOCFRONT = "DOCFRONT", DOCBACK = "DOCBACK" } export declare enum eCamShootFaceMode { USER = "user", ENVIRONMENT = "environment" } export interface ICamShootDevice { label: string; deviceId: string; isFront?: boolean; mode: eCamShootFaceMode; haveTorch: boolean; } export interface ICamShootConfig { displayTitle?: boolean; title?: string; showFaceMode?: boolean; canChangeMode?: boolean; type?: eCamShootType; color?: string; usePreview?: boolean; btnTakeAnother?: string; btnAcceptCapture?: string; } interface IZoomConfig { min: number; max: number; step: number; } export declare class NgxCamShoot { sendImage: EventEmitter<string | null>; private stream; modalCapture: boolean; isCaptured: boolean; imageCaptured: string | undefined; error: string; debug: string; video: ElementRef<HTMLVideoElement>; canvas: ElementRef<HTMLCanvasElement>; config: ICamShootConfig; canChangeMode: boolean; type: eCamShootType; color: string; displayTitle: boolean; title: string; showFaceMode: boolean; usePreview: boolean; showErrors: boolean; debugMode: boolean; btnTakeAnother: string; btnAcceptCapture: string; havePermissions: boolean; isChangingDevice: boolean; faceMode: eCamShootFaceMode; canUseFlash: boolean; canActiveFlash: boolean; isFlashActive: boolean; zoom: FormControl<number | null>; zoomConfig: IZoomConfig; canUseZoom: boolean; canActiveZoom: boolean; devices: ICamShootDevice[]; device: FormControl<string | null>; displayPreview: boolean; isMobile: boolean; hasTouchSupport: boolean; isLandscape: boolean; orientationDegs: number; screen_w: number; screen_h: number; fullScreenStart: boolean; private maxTryStream; resize(): void; constructor(); ngOnChanges(changes: SimpleChanges): void; ngOnInit(): void; private initConfig; initCapture(faceMode?: eCamShootFaceMode): void; takeCapture(): void; takeAnother(): void; sendCapture(): void; close(): void; private clearAndLoadDevices; private clear; drawImageToCanvas(image: any): void; private send; initDevices(): Promise<void>; cancelFullScreen(): void; requestFullScreen(): void; private requestPermissions; private assignDevice; private loadDevices; private startStream; private handleStream; toogleMode(): void; private checkFlash; private setDeviceFlash; toogleFlash(): void; private checkZoom; private updateZoom; private applyAdvanceConstraint; getZoomPercent(): string; private checkDeviceMode; private isFront; private getFrontDevices; private getBackDevices; get hasMultipleDevicesOnMode(): boolean; private pushDevice; private hasTouch; getErrors(): string; getDebugInfo(): string; getStyleConfig(): string; isDefault(): boolean; isSelfie(): boolean; isDocument(): boolean; isDocFront(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<NgxCamShoot, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NgxCamShoot, "ngx-cam-shoot", never, { "config": { "alias": "config"; "required": false; }; "canChangeMode": { "alias": "canChangeMode"; "required": false; }; "type": { "alias": "type"; "required": false; }; "color": { "alias": "color"; "required": false; }; "displayTitle": { "alias": "displayTitle"; "required": false; }; "title": { "alias": "title"; "required": false; }; "showFaceMode": { "alias": "showFaceMode"; "required": false; }; "usePreview": { "alias": "usePreview"; "required": false; }; "showErrors": { "alias": "showErrors"; "required": false; }; "debugMode": { "alias": "debugMode"; "required": false; }; "btnTakeAnother": { "alias": "btnTakeAnother"; "required": false; }; "btnAcceptCapture": { "alias": "btnAcceptCapture"; "required": false; }; }, { "sendImage": "sendImage"; }, never, never, true, never>; } export {};