Easy Tutorial
❮ Html Lists Att Keygen Disabled ❯

HTML Audio/Video DOM ended Event

HTML Audio/Video DOM Reference

Example

Display a message after the audio has finished playing:

More examples are included at the bottom of this page.


Definition and Usage

The ended event is triggered when the audio/video (audio/video) playback has completed.

This event is commonly used to indicate the completion of playback, such as displaying messages like "Thank you for listening" or "Thank you for watching".


Browser Support

The numbers in the table specify the first browser version that fully supports the event.

Event
ended Yes 9.0 Yes Yes Yes

Syntax

In HTML:

In JavaScript:

In JavaScript, using the addEventListener() method:

Note: The addEventListener() method is not supported in Internet Explorer 8 and earlier versions.


Supported HTML Tags: <audio> and <video>
Supported JavaScript Objects: Audio, Video
--- ---

More Examples

Example

Display a message after the video has finished playing:

var vid = document.getElementById("myVideo");
vid.onended = function() {
    alert("The video has ended");
};

❮ Html Lists Att Keygen Disabled ❯