Hello all,
I’m struggling with a project and was hoping someone might be able to help. I need to turn on the web cam of the device the prototype is running on and see the stream. I went trough the few threads I could find here:
but they are locked and of not much help really.
In one of those threads the user was successful in doing exactly what I need (https://dli2ts.axshare.com/#g=1&p=home), but with using the plugin functionality of axshare. In my case this is not an option, since the project must be run locally.
My traction so far is that I got the prototype to trigger the camera usage permission and turn it on, but I can’t figure out how to get the stream to show. Here is the example file: WebCam Access.rp (43.0 KB)
Unfortunately I’m not good with javascript and I have no idea how (if even possible) to pass the video to the inline frame.
Here is the script I use on load I took from this tutorial (https://webmobtuts.com/javascript/accessing-webcam-with-javascript-getusermedia/) and it goes like this:
navigator.mediaDevices.getUserMedia({ audio: true, video: true })
.then(function(stream) {
var video = document.querySelector(‘video’);
if (“srcObject” in video) {
video.srcObject = stream;
} else {
video.src = window.URL.createObjectURL(stream);
}
video.onloadedmetadata = function(e) {
video.play();
};
})
.catch(function(err) {
console.log(err.name + ": " + err.message);
});
I’ll be very grateful to anyone who could give me a hand with that. I guess it will also will generally be very helpful to a lot of people attempting to build the same functionality.