/** * @fileoverview * Set of factory implementations around Camera. * * @author mebjas */ import { Camera } from "./core"; import { CameraImpl } from "./core-impl"; /** Factory class for creating Camera. */ export class CameraFactory { /** * Returns {@link CameraFactory} if {@link navigator.mediaDevices} is * supported else fails. */ public static async failIfNotSupported(): Promise { if (!navigator.mediaDevices) { throw "navigator.mediaDevices not supported"; } return new CameraFactory(); } private constructor() { /* No Op. */ } /** Creates camera instance based on constraints. */ public async create(videoConstraints: MediaTrackConstraints) : Promise { return CameraImpl.create(videoConstraints); } }