This is an extension of this question
According to my research, for a video element on an iPhone/iPad, pressing both "Done" and "Pause" triggers a "pause" event. So if I have some desired webpage behavior that I want to initiate upon pressing the "done" button, I need to listen for the "pause" event.
player = document.getElementById('videoplayer');
player.addEventListener("pause", function() {
//desired "done button" behavior defined here
}, false);
According to Arv-ToolTwist's answer to that original question, the way one differentiates between "done" and "pause" is by checking for the webkitDisplayingFullscreen
boolean (since the "done" button exits out of fullscreen, the boolean will return false).
player.addEventListener("pause", function() {
if(!player.webkitDisplayingFullscreen) {
//desired "done button" behavior defined here
}
}, false);
However, in the case where a user pauses the video while the player is in fullscreen mode and then presses "done" while the video is paused, the "desired done button behavior" is not initiated.
My research is turning up little-to-no information on this, but my assumption is that either the "pause" event is not getting triggered a second time, or it gets triggered a second time prior to the webkitDisplayingFullscreen
boolean changing to "false". Either way, the device can tell the difference between both "done" and "pause" (even when the player is already paused), so I'm wondering
This is the event your looking for:
player.addEventListener('webkitendfullscreen', onVideoEndsFullScreen, false);
This event does indeed fire when the user presses the 'done' button. (iPhone/iTouch)
Was answered in this question, How to figure out when a HTML5 video player enters the full screen mode on iOS / iPads?
This just leaves the home button event...for which there seems to be no reliable event for (see bottom 2 posts) https://discussions.apple.com/thread/4182660?start=0&tstart=0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With