Skip to content

Instantly share code, notes, and snippets.

@jonathanhculver
Created September 1, 2013 18:23
Show Gist options
  • Save jonathanhculver/6406274 to your computer and use it in GitHub Desktop.
Save jonathanhculver/6406274 to your computer and use it in GitHub Desktop.
webrtc snapshot from webcam
function snapshot() {
if (localMediaStream) {
var img = document.querySelector('img');
/* draws the image to the canvas */
ctx.drawImage(video, 0, 0);
/* loads the img to the hidden img tag */
img.src = canvas.toDataURL('image/webp');
img.style.display= "block";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment