webkitExitFullScreen is a method of the video element, so it should be called as follows:
videoElement.webkitExitFullscreen(); //or $("#myVideoTag")[0].webkitExitFullscreen(); //or, without needing jQuery document.getElementsById('myVideoTag').webkitExitFullscreen();
Since inside the event handler this will be video , which ended , therefore:
$("#myVideoTag").on('ended', function(){ this.webkitExitFullscreen(); });
This webkitExitFullScreen little complicated because webkitExitFullScreen only works in webkit-based browsers (Safari, Chrome, Opera), so you can learn more about its proper use on MDN
cbaigorri
source share