const video = document.querySelector("video");
video.addEventListener("ended", (event) => {
console.log(
"Video stopped either because it has finished playing or no further data is available.",
);
});HTMLMediaElement: ended event / notebook
HTMLMediaElement: ended event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const video = document.querySelector("video");
video.onended = (event) => {
console.log(
"Video stopped either because it has finished playing or no further data is available.",
);
};