HTML 参考手册
HTML 音频/视频 DOM playbackRate 属性
将视频设置为慢速播放
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <button onclick="getPlaySpeed()" type="button">回放的速度是多少?</button> <button onclick="setPlaySpeed()" type="button">视频设置为慢速播放</button> <br> <video id="video1" controls="controls"> <source src="/examples/mov_bbb.mp4" type="video/mp4"> <source src="/examples/mov_bbb.ogg" type="video/ogg"> 您的浏览器不支持 HTML5 video 标签。 </video> <script> myVid = document.getElementById("video1"); function getPlaySpeed() { alert(myVid.playbackRate); } function setPlaySpeed() { myVid.playbackRate = 0.5; } </script> <p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p> </body> </html>
运行结果:
点击运行 »