Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Execute a script each time the playback rate changes in HTML?
Use the onratechange attribute to execute a script each time the playback rate changes in HTML in HTML.
Example
You can try to run the following code to implement onratechange attribute −
<!DOCTYPE html>
<html>
<body>
<video id = "myid" width = "320" height = "176" controls onratechange = "display()">
<source src = "/html5/foo.ogg" type = "video/ogg" />
<source src = "/html5/foo.mp4" type = "video/mp4" />
Your browser does not support the video element.
</video>
<p id="test">Change the speed of the video</p>
<input type = "range" min = "0.1" max = "3" step = "0.2" value = "1"oninput = "update(this)">
<script>
function display() {
document.getElementById("test").innerHTML = "Speed: " + document.getElementById("myid").playbackRate;
}
function update(ob) {
document.getElementById("myid").playbackRate = ob.value;
}
</script>
</body>
</html>
Output

Advertisements