<!DOCTYPE html>
<html>
<body>
<p>在本例中,我们为 video 元素分配了 "onratechange" 事件。playbackRate 属性用于更改视频的播放速度。</p>
<video id="myVideo" width="320" height="240" autoplay controls onratechange="myFunction()">
<source src="/i/photo/shanghai.mp4" type="video/mp4">
Your browser does not support the video tag.
</video><br>
<button onclick="setPlaySpeed()" type="button">设置视频以慢动作播放</button>
<script>
var x = document.getElementById("myVideo");
function setPlaySpeed() {
x.playbackRate = 0.3;
}
function myFunction() {
alert("The playing speed of the video was changed");
}
</script>
</body>
</html>