Note that there are some explanatory texts on larger screens.

plurals
  1. POWith an HTML5 video element on the iphone, how can I detect the difference between "pause" and "done"?
    text
    copied!<p>This is an extension of <a href="https://stackoverflow.com/questions/3097545/using-html5-video-events-on-the-iphone-how-do-i-tell-done-button-click-from-a/11111482" title="this question">this question</a></p> <p>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.</p> <pre><code>player = document.getElementById('videoplayer'); player.addEventListener("pause", function() { //desired "done button" behavior defined here }, false); </code></pre> <p>According to <a href="https://stackoverflow.com/a/5260176/1065525">Arv-ToolTwist's answer</a> to that original question, the way one differentiates between "done" and "pause" is by checking for the <code>webkitDisplayingFullscreen</code> boolean (since the "done" button exits out of fullscreen, the boolean will return false).</p> <pre><code>player.addEventListener("pause", function() { if(!player.webkitDisplayingFullscreen) { //desired "done button" behavior defined here } }, false); </code></pre> <p>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. </p> <p>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 <code>webkitDisplayingFullscreen</code> 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 </p> <ol> <li>how the device tells the difference, and </li> <li>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.</li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload