解决方法
<audio id="warp" preload="auto" controls> <source src="warp.mp3" type="audio/mp3"> <source src="warp.ogg" type="audio/ogg"> </audio> <script> var a = document.getElementById('warp'); var t = a.currentTime; var d = a.duration; var z = a.buffered.end(a.buffered.length-1); </script>
z是当前缓冲的音频的秒数.t是播放头所在音轨开头的秒数.d是音轨的总秒数.