<video id="video1" controls width="270" autoplay>
<source src="/example/html5/mov_bbb.mp4" type='video/mp4'>
<source src="/example/html5/mov_bbb.ogg" type='video/ogg'>
<source src="/example/html5/mov_bbb.webm" type='video/webm'>
<p>画布(每 20 毫秒,代码就会绘制视频的当前帧):</p>
<canvas id="myCanvas" width="270" height="135" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.
var v=document.getElementById("video1");
var c=document.getElementById("myCanvas");
v.addEventListener('play', function() {var i=window.setInterval(function() {ctx.drawImage(v,0,0,270,135)},20);},false);
v.addEventListener('pause',function() {window.clearInterval(i);},false);
v.addEventListener('ended',function() {clearInterval(i);},false);