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
- how the device tells the difference, and
- whether there's a way to detect when the player exits the fullscreen mode, so that even when the player is already paused, pressing the "done" button is still detected and the desired behavior still gets initiated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…