UNPKG

ziko

Version:

a versatile javaScript framework offering a rich set of UI components, advanced mathematical utilities, reactivity, animations, client side routing and graphics capabilities

27 lines (26 loc) 778 B
import { ZikoUIVideo } from "../../../media"; class ZikoUIWebcame extends ZikoUIVideo{ constructor(){ super() this.element?.setAttribute("src", ""); this.constraints = { audio: true, video: { width: 1280, height: 720 } }; //this.video=this.element } get isInputCamera(){ return true; } start(){ navigator.mediaDevices.getUserMedia(this.constraints).then((mediaStream)=>{ this.element.srcObject = mediaStream; this.element.onloadedmetadata = () =>{ this.element.play(); }; }) .catch(function(err) { console.log(err.name + ": " + err.message); }); return this; } } const inputCamera=()=>new ZikoUIWebcame(); export{ inputCamera }