Code
Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy onratechange attribute</title> </head> <body> <audio id="myaudio" controls onratechange="onRateChange()"> <source src="wikitechy.wav" type="audio/wav"> <source src="wikitechy.mp3" type="audio/mp3"> </audio> <p id="rate">Change the Audio speed</p> <input type="range" min="0.5" max="5" step="0.1" value="1" oninput="changeRate(this)"> <script> function onRateChange() { document.getElementById("rate").innerHTML="The Audio's speed is " + document.getElementById("myaudio").playbackRate; } function changeRate(obj) { document.getElementById("myaudio").playbackRate = obj.value; } </script> </body> </html>
Result