The ended event is fired when playback or streaming has stopped because the end of the media was reached or because no further data is available.
This event occurs in three related but unique contexts.
The ended event is fired at <audio> and <video> when playback reaches the end of the media.