-viewof camera = checkbox({+viewof cameraOn = checkbox({description: 'Check to activate your webcam', options: [ { value: 'toggle', label: 'On' } ], value: null })
-webcam = { if (camera) { const vid = html`<video id="webcam" autoplay="true" id="vid"></video>`; navigator.getUserMedia({video: true}, (stream) => { vid.src = window.URL.createObjectURL(stream); }, ()=>{}); return vid; } else { return "No camera." }+async function getUserMediaToVideo() { let stream = null; try { const vid = html`<video autoplay="true"></video>`; stream = await navigator.mediaDevices.getUserMedia({ audio: false, video: true // { width: 1280, height: 720 } }); vid.srcObject = stream; // vid.src = URL.createObjectURL(stream); return vid; } catch (err) { console.log(err); return err.toString(); }}
-viewof takePic = button({"value" : "Take a picture", "description": "Click to take a pic"})+viewof takePic = button({ value: "Take a picture", description: "Click to take a pic" })