Audio currentTime Attribute

Definition and Usage

currentTime The property sets or returns the current position of the audio playback (in seconds).

When setting this property, the playback will jump to the specified position.

Example

Set the time position to 1 second:

document.getElementById("myAudio").currentTime = 1;

亲自试一试

语法

返回 currentTime 属性:

audioObject.currentTime

设置 currentTime 属性:

audioObject.currentTime = seconds

属性值

描述
seconds 规定音频播放的位置,以秒为单位。

技术细节

返回值: 数值,以秒为单位表示当前播放时间。

浏览器支持

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
支持 支持 支持 支持 支持