/** * Represents a value that may be of type T, or null. */ export type Nullable = T | null; export type ExtendedMediaTrackCapabilities = { /** * - The width of the video track. */ width?: ULongRange | undefined; /** * - The height of the video track. */ height?: ULongRange | undefined; /** * - The pan level of the camera. */ pan?: ULongRange | undefined; /** * - The tilt level of the camera. */ tilt?: ULongRange | undefined; /** * - The zoom level of the camera. */ zoom?: ULongRange | undefined; /** * - The native track capabilities. */ nativeMediaTrackCapabilities?: MediaTrackCapabilities | undefined; }; export type ExtendedMediaTrackConstraints = { /** * - The video constraints. */ video: MediaTrackConstraints & { pan: boolean; tilt: boolean; zoom: boolean; torch: boolean; }; /** * - The audio constraints. */ audio: MediaTrackConstraints | boolean; }; /** * @summary A custom element that implements the MediaDevices.getUserMedia() method of the MediaDevices interface to capture a photo in the browser. * @documentation https://github.com/georapbox/capture-photo-element * * @tagname capture-photo This is the default tag name, unless overridden by the `defineCustomElement` method. * @extends HTMLElement * * @property {boolean} autoPlay - Whether or not to start the video stream automatically. * @property {boolean} noImage - Whether or not to show the captured image. * @property {string} facingMode - The facing mode of the camera. * @property {string} cameraResolution - The resolution of the camera. * @property {number} pan - The pan value of the camera. * @property {number} tilt - The tilt value of the camera. * @property {number} zoom - The zoom value of the camera. * @property {boolean} torch - Whether or not the fill light is connected. * @property {boolean} calculateFileSize - Whether or not to calculate the file size of the captured image. * @property {boolean} loading - Whether or not the video stream is loading. * * @atttribute {boolean} auto-play - Reflects the autoPlay property. * @atttribute {boolean} no-image - Reflects the noImage property. * @atttribute {string} facing-mode - Reflects the facingMode property. * @atttribute {string} camera-resolution - Reflects the cameraResolution property. * @atttribute {number} pan - Reflects the pan property. * @atttribute {number} tilt - Reflects the tilt property. * @atttribute {number} zoom - Reflects the zoom property. * @atttribute {boolean} torch - Reflects the torch property. * @atttribute {boolean} calculate-file-size - Reflects the calculateFileSize property. * @atttribute {boolean} loading - Reflects the loading property. * * @slot capture-button - The capture button. * @slot capture-button-content - The capture button content. * @slot actions - The actions container. * @slot - A default un-named slot to add content inside the component. * * @csspart video - The video element. * @csspart actions-container - The actions container. * @csspart capture-button - The capture button. * @csspart output-container - The output container. * @csspart output-image - The output image. * * @event capture-photo:video-play - Fires when the video stream is successfully playing. * @event capture-photo:success - Fires when the photo is successfully captured. * @event capture-photo:error - Fires when an error occurs. * * @method defineCustomElement - Static method. Defines the custom element with the given name. * @method isSupported - Static method. Checks if the MediaDevices.getUserMedia() method is supported. * @method getVideoInputDevices - Static method. Gets the available video devices. * @method startVideoStream - Instance method. Starts the video stream. * @method restartVideoStream - Instance method. Restarts the video stream. * @method stopVideoStream - Instance method. Stops the video stream. * @method capture - Instance method. Captures a photo. * @method getSupportedConstraints - Instance method. Gets the supported constraints. * @method getTrackCapabilities - Instance method. Gets the track capabilities. * @method getTrackSettings - Instance method. Gets the track settings. */ export class CapturePhoto extends HTMLElement { static get observedAttributes(): string[]; /** * Returns the available video input devices. * * @returns {Promise} */ static getVideoInputDevices(): Promise; /** * Checks if the `MediaDevices.getUserMedia()` method is supported. * * @returns {boolean} */ static isSupported(): boolean; /** * Defines a custom element with the given name. * The name must contain a dash (-). * * @param {string} [elementName='capture-photo'] - The name of the custom element. * @example * * CapturePhoto.defineCustomElement('my-capture-photo'); */ static defineCustomElement(elementName?: string | undefined): void; /** * Lifecycle method that is called when attributes are changed, added, removed, or replaced. * * @param {string} name - The name of the attribute. * @param {string} oldValue - The old value of the attribute. * @param {string} newValue - The new value of the attribute. */ attributeChangedCallback(name: string, oldValue: string, newValue: string): void; /** * Lifecycle method that is called when the element is added to the DOM. */ connectedCallback(): Promise; /** * Lifecycle method that is called when the element is removed from the DOM. */ disconnectedCallback(): void; set autoPlay(value: boolean); /** * @type {boolean} autoPlay - Whether or not to start the video stream automatically. * @attribute auto-play - Reflects the autoPlay property. */ get autoPlay(): boolean; set noImage(value: boolean); /** * @type {boolean} noImage - Whether or not to show the captured image. * @attribute no-image - Reflects the noImage property. */ get noImage(): boolean; set facingMode(value: string); /** * @type {string} facingMode - The facing mode of the camera. * @attribute facing-mode - Reflects the facingMode property. */ get facingMode(): string; set cameraResolution(value: string); /** * @type {string} cameraResolution - The resolution of the camera. * @attribute camera-resolution - Reflects the cameraResolution property. */ get cameraResolution(): string; set pan(value: number); /** * @type {number} pan - The pan value of the camera. * @attribute pan - Reflects the pan property. */ get pan(): number; set tilt(value: number); /** * @type {number} tilt - The tilt value of the camera. * @attribute tilt - Reflects the tilt property. */ get tilt(): number; set zoom(value: number); /** * @type {number} zoom - The zoom value of the camera. * @attribute zoom - Reflects the zoom property. */ get zoom(): number; set torch(value: boolean); /** * @type {boolean} torch - Whether or not the fill light is connected. * @attribute torch - Reflects the torch property. */ get torch(): boolean; set calculateFileSize(value: boolean); /** * @type {boolean} calculateFileSize - Whether or not to calculate the file size of the captured image. * @attribute calculate-file-size - Reflects the calculateFileSize property. */ get calculateFileSize(): boolean; /** * @type {boolean} loading - Whether or not the video stream is loading. * @attribute loading - Reflects the loading property. */ get loading(): boolean; /** * Starts the video stream. * * @param {string} [videoInputId] - The video input device ID. * @returns Promise */ startVideoStream(videoInputId?: string | undefined): Promise; /** * Restarts the video stream. * * @param {string} [videoInputId] - The video input device ID. */ restartVideoStream(videoInputId?: string | undefined): void; /** * Stops the video stream. */ stopVideoStream(): void; /** * Captures a photo using the element's properties. * * @returns Promise */ capture(): Promise; /** * Returns an object based on the `MediaTrackSupportedConstraints` dictionary, * whose member fields each specify one ofthe constrainable properties the user agent understands. * * @see https://developer.mozilla.org/docs/Web/API/MediaDevices/getSupportedConstraints * @returns {MediaTrackSupportedConstraints | {}} */ getSupportedConstraints(): MediaTrackSupportedConstraints | {}; /** * Returns a `MediaTrackCapabilities` object which specifies the values or range of values * which each constrainable property, based upon the platform and user agent. * * @see https://developer.mozilla.org/docs/Web/API/MediaStreamTrack/getCapabilities * @returns {MediaTrackCapabilities | {}} */ getTrackCapabilities(): MediaTrackCapabilities | {}; /** * Returns a `MediaTrackSettings` object containing the current values of each of * the constrainable properties for the current MediaStreamTrack. * * @see https://developer.mozilla.org/docs/Web/API/MediaStreamTrack/getSettings * @returns {MediaTrackSettings | {}} */ getTrackSettings(): MediaTrackSettings | {}; #private; } //# sourceMappingURL=capture-photo.d.ts.map