Capture Image from the Webcam through HTML5

Access User Webcam through HTML5 api. Read Full detail on http://www.attuts.com/webcam-and-video-using-html5-send-video-image-to-server/

by padma rubhan

HTML

<video id="video" width="640" height="480" autoplay></video>
<button id="snap">Snap Photo</button>
<canvas id="canvas" width="640" height="480"></canvas>
<input type="file" accept="image/*;capture=camera">

JavaScript

(()=>{
var video = document.getElementById('video');

// Get access to the camera!
if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
    // Not adding `{ audio: true }` since we only want video now
    navigator.mediaDevices.getUserMedia({ video: true }).then(function(stream) {
        //video.src = window.URL.createObjectURL(stream);
        video.srcObject = stream;
        video.play();
    });
}
})();