Javascript examples for DOM Event:Element Event Attribute
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() {/* w w w .j a v a2 s .co m*/ x.playbackRate = 0.3; } x.onratechange = function() {myFunction()}; function myFunction() { console.log("The playing speed of the video was changed"); } </script> </body> </html>