2015-06-25 100 views
0

我爲無線電播放器使用Javascript,因此,有時有人得到一個錯誤的網絡和連接退出,我想知道是否有緩衝功能,如果它崩潰重新加載流。 我希望有人能回答,謝謝。音頻源上的緩衝

問候, 朱莉婭。

+0

使用沒發現HTML音頻 – Hammad

+0

的緩衝性能,我已經搜查了音頻標籤PARAMS但沒有... 你能給我舉個例子嗎? – Julia

回答

0

如果您的使用案例是無線電數據流,因此您無法訪問過去的數據,如果該使用案例只是一個媒體播放器,您可以使用音頻元素的buffered屬性來查詢哪個範圍此時已緩存的媒體或currentTime屬性訪問當前執行時間。

var myAudioElement = document.createElementbyTag('audio') 
// let's suppose that the audio element has a radio streaming attached as source 
myAudioElement.buffered // returns the last data that has been downloaded from the source 
myAudioElement.currentTime // returns the time of the last data played 

也許你應該看到類似connection API要知道當你的用戶下線