有没有办法判断一首歌曲是否正在缓冲?
当我点击播放并且歌曲开始播放时,事件会被触发,但是一旦歌曲开始播放后,如果数据传输不够快,它就会“暂停”,但不会触发任何事件。
我尝试过:
audioElement.addEventListener('suspend',function (){
console.log('suspended'); //Fires the first time song is being "buffered"
});
audioElement.addEventListener('playing',function (){
console.log('playing'); //Fires the first time the song is played.
});
我该如何检查数据是否正在缓冲,以便我可以通过某些指示告诉用户等待?