How can I detect when a video on iOS is closed? I am running videojs which launches HTML5 videos as native video players. In order to react properly, I want to get an event when the native player is closed.
There are several similar questions to this one around here, but non of the answers work.
First solution I tried:
player.addEventListener('webkitendfullscreen', onVideoEndsFullScreen, false);
Solution was proposed in 2012 here: How to figure out when a HTML5 video player enters the full screen mode on iOS / iPads?
This method doesn't work for me. The event doesn't get fired (at least in iOS simulator) and I can't do anything with it.
Second solution I tried
// Do on resize
if(video.webkitDisplayingFullscreen == false){
// Exit was triggered
}
Solution was proposed even earlier than 2012 here: Is there an "onClose" event for the fullscreen video player on iPhone?
This method also doesn't work, the video element does not have this attribute (at least in iOS simulator). BTW, this method is deprecated.
Does anyone have an idea about how to get notified about iOS leaving fullscreen nowadays?