Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html> 
<html> 
<body> 
<p>In this example, we assign an "onratechange" event to a video element. The playbackRate property is used to change the playing speed of the video.</p>
<video id="myVideo" width="320" height="240" autoplay controls onratechange="myFunction()">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video><br>
<button onclick="setPlaySpeed()" type="button">Set video to be play in slow motion</button>
<script>
// Get the video element with id="myVideo"
var x = document.getElementById("myVideo");
// Set the current playback speed of the video to 0.3 (slow motion)
function setPlaySpeed() { 
  x.playbackRate = 0.3;
} 
// Alert some text when the playing speed of the video is changed
function myFunction() { 
  alert("The playing speed of the video was changed");
}
</script> 
</body> 
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onratechange_html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:40:03 GMT -->
</html>