Latest web development tutorials

HTML DOM Audio played Properties

Audio Object Reference Audio Object

Examples

Get the audio to the first paragraph of the scope (part) in seconds elapsed:

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

x The output is:

Start: 0 End: 2.162583

try it"

Definition and Usage

played TimeRanges property returns an object.

TimeRanges objects that the user has been played or seen the audible range.

Has been broadcast range refers to the audio playback time. If you jump in the audio, a plurality of the playback range is obtained.

Note: This property is read-only.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support played attribute.

Note: Internet Explorer 8 and earlier versions of IE does not support this property.


grammar

audioObject .played

return value

类型 描述
TimeRanges 对象

表示音频的已播范围。

TimeRanges 对象的属性:

  • length - 获得音频中已播范围的数量
  • start(index) - 获得某个已播范围的开始位置
  • end(index) - 获得某个已播范围的结束位置

注释:首段已播范围的下标是 0。



Audio Object Reference Audio Object