Created
July 30, 2018 23:14
-
-
Save nbw/9ee6cb5d3d00a40b59102115131db387 to your computer and use it in GitHub Desktop.
Drawing a video on canvas
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
//javascript | |
var canvas = document.querySelector('canvas'); | |
canvas.width = ...; | |
canvas.height = ...; | |
var context = canvas.getContext('2d'); | |
context.drawImage(video, 0, 0, canvas.width, canvas.height); | |
// video 'play' event listener | |
video.addEventListener('play', function() { | |
context.drawImage(this, 0, 0, canvas.width, canvas.height); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment