!7 cmodule WebCamDemo > DynPrintLog { !include #1029545 // API for Eleu O html(IWebRequest request) { //ret "URI: " + request.uri(); ret hsansserif() + hfullcenter(p("WebCam Preview") + hfulltag video("", autoplay := true, id := "webcamPreview", style := "width: 600px; height: 400px; border: 5px solid red;") + p("Snapshot") + tag canvas("", id := "snapshotCanvas", style := "width: 300px; height: 200px") ) + hscript([[ var video = document.querySelector("#webcamPreview"); if (navigator.mediaDevices.getUserMedia) { navigator.mediaDevices.getUserMedia({ video: true }) .then(function (stream) { video.srcObject = stream; }) .catch(function (err0r) { console.log("Something went wrong: " + err0r); }); }; ]]); } }