[Jprogramming] JHS navigator.mediaDevices.getUserMedia fails

Brian Schott schott.brian at gmail.com
Sat Jun 3 18:11:59 UTC 2017


The webcam access demo at the following link works in my browsers, but my
attempt to access my webcam from inside JHS fails.

https://davidwalsh.name/browser-camera
https://davidwalsh.name/demo/camera.php

​In the JS code below​ I only see the alert "MEDIA" if I leave off the
second part of the condition; that is I DO get the alert if the condition
is simply "if(navigator.mediaDevices)".

​Could the reason be that I have not found a way to INClude​ webgl (that
is, use INC=:webgl)? I have not found a way to do that.

Another idea for the reason of the failure is that
"navigator.mediaDevices.getUserMedia"
requires some permission of the user, which is JHS, I presume, that I don't
know how to provide.


JS=: 0 : 0
function ev_body_load(){init();}
function init() {
        var canvas = document.getElementById("glcanvas");
        gl = canvas.getContext("webgl");
if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia ) {
alert("
​MEDIA
");
}
}
​)​

-- 
(B=)


More information about the Programming mailing list