Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Audio currentTime attribute

Audio currentTime attribute

Audio Object Reference Audio object

Example

Set the time position to 1 second:

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

Try it »


Definition and Usage

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

When this attribute is set, playback jumps to the specified position.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the currentTime attribute.

Note: Internet Explorer 8 or earlier browsers do not support this attribute.


Syntax

Return the currentTime attribute:

audioObject

.currentTime

Set the currentTime attribute:

audioObject

.currentTime=

seconds

Attribute values

Value Description
seconds Indicates the current position of audio playback (in seconds).

Technical Details

Return Value: A number representing the current playback time (in seconds).

Audio Object Reference Audio object