Reputation: 111
I have a video which plays when I press a button. After the video finishes, my jQuery code changes some things on the webpage. I need my jQuery to detect when the user plays the video and exits full screen.
Something like this:
Any help would be great.
Upvotes: 0
Views: 930
Reputation: 1917
but i think it just work on chrome.
$(document).on('webkitExitFullScreen', function() {
alert("Full Screen Closed");
});
Upvotes: 0
Reputation: 337560
To achieve this you can hook to the fullscreenchange
event and check the state of the video with the fullScreen
property. Note that you will need to use some browser-specific properties to achieve this too. Try this:
$('#myVideo').bind('webkitfullscreenchange mozfullscreenchange fullscreenchange', function(e) {
var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
// work with the state flag here...
});
Upvotes: 1