这是HTML5中Canvas技术与Video技术结合的实例。效果图:
以下代码不能运行,只提供学习查看。若想预览该实例请浏览http://html5demos.com/video-canvas (浏览器支持:只支持Safari, Firefox) <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Dizzy</title> <style> * { margin: 0;} body { font-family: helvetica; padding: 10px; } input { width: 50px; } /*video, canvas { display: block; }*/ p { margin-top: 20px;} </style> </head> <body> <video height="360" width="480"> <source src="dizzy.mp4" /> <source src="dizzy.ogv" /> </video><canvas></canvas> <p> <input type="button" id="play" value="play"> <span id="position">00:00</span> / <span id="duration"></span> </p> </body> </html> 提示:可修改后代码再运行!