Audio endedProperty

Audio 对象参考手册Audio Object

Examples

Check whether the audio has finished playing:

var x = document.getElementById("myAudio").ended;

xThe output result is:

true

Try it yourself »

Definition and Usage

The ended property returns whether the audio has ended.

If the playback position is at the end of the audio, then the audio has ended.

Note:This property is read-only.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the ended property.

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


Syntax

audioObject.ended

Technical Details

Return value: Boolean value: returns true if the audio has finished playing. Otherwise, returns false.


Audio 对象参考手册Audio Object Other Extensions