Question

How can I enable getUserMedia/HTML5 Webcam access calls on Raspbian(chromium) to the camera? I only found answers to stream pictures to HTML5 sites, but I actually need this on device. I already have the code running to get the Pictures with JS. Moreover, raspivid is showing me correct pictures. So how do I make Chromium to notice the camera? Thank you!

Was it helpful?

Solution 2

You can use a bit of a JavaScript workaround, as the actual methods for recording directly from the browser using getusermedia aren't implemented yet. Whammy.js is a good place to start (https://github.com/antimatter15/whammy) and there's a good guide here: http://www.html5rocks.com/en/tutorials/getusermedia/intro/ (Too much code for me to put here!)

Not sure if that's what you're asking, but it's there should you need it.

OTHER TIPS

If you just want to stream video from the camera into a web page then this is straightforward.

You need to use Firefox or Chrome as the browser (and Opera??), create element in your web page and then include JS code similar to this:

        navigator.getUserMedia(
            {
              video: true,
              audio: false
            },
            function(stream) {
              if (navigator.mozGetUserMedia) {
                video.mozSrcObject = stream;
              } else {
                var url = window.URL || window.webkitURL;
                video.src = url ? url.createObjectURL(stream) : stream;
              }
              mediaStream = stream;
              video.play();
            },
            function(error) {
              console.log("ERROR: " + error);
            }
        );

There are details to deal with such as resizing the output window to match the input stream.

Take a look at my Tutorial on this which includes a simple working demo and complete code - as well as static image capture from the video feed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top