Javascript examples for DOM Event:addEventListener
The onratechange event occurs when the playing speed of the audio/video is changed (like when a user switches to a slow motion or fast forward mode).
Bubbles | No |
---|---|
Cancelable | No |
Supported HTML tags: | <audio> and <video> |
<!DOCTYPE html> <html> <body> <video id="myVideo" width="320" height="240" autoplay controls> <source src="your.mp4" type="video/mp4"> <source src="your.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> var x = document.getElementById("myVideo"); function setPlaySpeed() {// ww w . j a v a 2 s. c o m x.playbackRate = 0.3; } x.addEventListener("ratechange", myFunction); function myFunction() { console.log("The playing speed of the video was changed"); } </script> </body> </html>