import {requestVideoStream, requestDisableVideo} from './camera.js'; import log from '../log.js'; /** * Video Manager for video extensions. */ class VideoProvider { constructor () { /** * Default value for mirrored frames. * @type boolean */ this.mirror = true; /** * Cache frames for this many ms. * @type number */ this._frameCacheTimeout = 16; /** * DOM Video element * @private */ this._video = null; /** * Usermedia stream track * @private */ this._track = null; /** * Stores some canvas/frame data per resolution/mirror states */ this._workspace = []; } static get FORMAT_IMAGE_DATA () { return 'image-data'; } static get FORMAT_CANVAS () { return 'canvas'; } /** * Dimensions the video stream is analyzed at after its rendered to the * sample canvas. * @type {Array.} */ static get DIMENSIONS () { return [480, 360]; } /** * Order preview drawable is inserted at in the renderer. * @type {number} */ static get ORDER () { return 1; } /** * Get the HTML video element containing the stream */ get video () { return this._video; } /** * Request video be enabled. Sets up video, creates video skin and enables preview. * * @return {Promise.