Play the audio in slow motion:
document.getElementById("myAudio").playbackRate = 0.5;
<!DOCTYPE html> <html> <body> <audio id="myAudio" controls> <source src="sound.ogg" type="audio/ogg"> <source src="sound.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio><br> <p id="demo"></p> <button onclick="getPlaySpeed()" type="button">What is playback speed?</button> <button onclick="setPlaySpeed()" type="button">Set audio to be play in slow motion</button> <script> var x = document.getElementById("myAudio"); function getPlaySpeed() { /*from www . ja va 2 s.c om*/ document.getElementById("demo").innerHTML = x.playbackRate; } function setPlaySpeed() { x.playbackRate = 0.5; } </script> </body> </html>
The playbackRate
property sets or gets the current play speed of the audio.
Example values: