I've been looking all over and couldn't find any concise information
Using JavaScript and HTML, how can I determine when a video becomes fullscreen?
How can I determine when the video leaves fullscreen?
I've been looking all over and couldn't find any concise information
Using JavaScript and HTML, how can I determine when a video becomes fullscreen?
How can I determine when the video leaves fullscreen?
April 21, 2015 -- solution I found:
var video = document.querySelector("#myVideo");
video.addEventListener("webkitfullscreenchange", function (e) {
console.log('isFullscreen ', e.target.webkitDisplayingFullscreen);
});
If you inspect the event object, you will see bubbles: true
, meaning that all ancestor (window, document) nodes should also see the event, and the listener can be attached to them as well
fullscreenchange
Event:
https://developer.mozilla.org/en-US/docs/Web/Events/fullscreenchange
Similar question:
How to figure out when a HTML5 video player enters the full screen mode on iOS / iPads?