Use the onended attribute in HTML to execute a script when the media has reached the end in HTML . You can add messages like “Thank you for watching”, “Stay tuned!”, etc.
Example
You can try to run the following code to implement the onended attribute −
<!DOCTYPE HTML>
<html>
<body>
<video width = "300" height = "200" controls onended = "display()">
<source src = "/html5/foo.ogg" type = "video/ogg" />
Your browser does not support the video element.
</video>
<script>
function display() {
alert ("Thank you for watching! Stay tuned!");
}
</script>
</body>
</html>