Skip to content

Instantly share code, notes, and snippets.

@kypflug
Created Jun 11, 2015
Embed
What would you like to do?
function capturePhoto()
{
var video = document.getElementById('videoTag');
var canvas = document.getElementById('canvasTag');
var videoWidth = video.videoWidth;
var videoHeight = video.videoHeight;
if (canvas.width !== videoWidth || canvas.height !== videoHeight)
{
canvas.width = videoWidth;
canvas.height = videoHeight;
}
var ctx = canvas.getContext('2d');
ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment