简单教程
提交运行
代码编辑器:
<audio id="myAudio" controls> <source src="/static/i/html/horse.ogg" type="audio/ogg"> <source src="/static/i/html/horse.mp3" type="audio/mpeg"> 您的浏览器不支持 audio 元素。 </audio><br> <button onclick="getPlaySpeed()" type="button">音频播放速度?</button> <button onclick="setPlaySpeed()" type="button">设置音频快速播放</button> <script> var x = document.getElementById("myAudio"); function getPlaySpeed(){ alert(x.playbackRate); } function setPlaySpeed(){ x.playbackRate = 2; } </script>
运行结果: