Created
September 1, 2013 18:23
-
-
Save jonathanhculver/6406274 to your computer and use it in GitHub Desktop.
webrtc snapshot from webcam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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