.onended()
this function use in end video.
The ended event occurs when the audio/video has reached the end.
This event is useful for messages like “thanks for listening”, “thanks for watching”, etc.
example:-
var vid = document.getElementById("vid");
vid.onended = function() {
alert("The video has ended");
this.exitFullscreen();
/*any this you add this function*/
};
CLICK HERE to find out more related problems solutions.