Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (37 sloc) 1.18 KB
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Video Frames</title>
<link rel="stylesheet" href="../include/style.css">
<style>
#movieclip {
display: none;
}
</style>
</head>
<body>
<header>
Example from <a href="http://amzn.com/1430236655?tag=html5anim-20"><em>Foundation HTML5 Animation with JavaScript</em></a>
</header>
<canvas id="canvas" width="600" height="360"></canvas>
<aside>Video file may take a moment to load.</aside>
<video id="movieclip" width="640" height="360" autoplay>
<source src="./assets/movieclip.mp4" type="video/mp4"/>
<source src="./assets/movieclip.webm" type="video/webm"/>
<source src="./assets/movieclip.ogv" type="video/ogg"/>
</video>
<script src="../include/utils.js"></script>
<script>
window.onload = function () {
var canvas = document.getElementById('canvas'),
context = canvas.getContext('2d'),
video = document.getElementById('movieclip');
(function drawFrame () {
window.requestAnimationFrame(drawFrame, canvas);
context.drawImage(video, 0, 0);
}());
};
</script>
</body>
</html>