如何知道html5音频中缓冲数据的进度?

Irf*_*fan 8 html5-audio

使用带有Ogg媒体文件的html5音频标签,我如何使用javascript,检索客户端(实时)加载了多少数据.

Ahi*_*una 24

<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>
Run Code Online (Sandbox Code Playgroud)

z是当前缓冲的音频的秒数.t是播放头所在音轨开头的秒数.d是音轨的总秒数.