Skip to content

Instantly share code, notes, and snippets.

View fritzy's full-sized avatar
💽
Please Insert Disk III

Nathan Fritz fritzy

💽
Please Insert Disk III
  • Kennewick, WA
  • 18:32 (UTC -07:00)
  • X @fritzy
View GitHub Profile
@fritzy
fritzy / video_to_canvas.js
Created July 11, 2013 16:47
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);
}