Audio buffered 属性

定义和用法

buffered 属性返回 TimeRanges 对象。

TimeRanges 对象表示用户缓冲的音频范围。

缓冲范围是缓冲音频的时间范围。如果在音频中跳跃,用户将获得几个缓冲范围。

Note:该属性只读。

实例

以秒为单位获取音频的第一个缓冲范围(部分):

var x = document.getElementById("myAudio");
document.getElementById("demo").innerHTML = "Start: " + x.buffered.start(0)
+ " End: " + x.buffered.end(0);

亲自试一试

语法

audioObject.buffered

返回值

Return value Type
Description

TimeRanges object

Represents the buffered part of the audio.

  • TimeRanges object properties:
  • length - Get the number of buffer ranges in the audioindexstart(
  • ) - Get the start position of the buffer rangeindex) - Get the end position of the buffer range

Note:The first buffer range is index 0.

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support