Skip to content

Instantly share code, notes, and snippets.

@fritzy
Created July 11, 2013 16:47
Show Gist options
  • Save fritzy/5977140 to your computer and use it in GitHub Desktop.
Save fritzy/5977140 to your computer and use it in GitHub Desktop.
Want to draw a video onto a canvas? Here's how simple it is.
function video2Canvas(video, canvas) {
var ctx = canvas.getContext('2d');
function draw() {
ctx.drawImage(video, 0, 0, video.width, video.height, 0, 0, canvas.width, canvas.height);
requestAnimationFrame(draw);
}
requestAnimationFrame(draw);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment