Search code examples
javascriptandroidiphonejwplayerjwplayer7

detect pause and 'done' button's click on iphone for jwplayer7


How can I detect pause and 'done' buttons's click on iphone, when video plays within native player ? Need to detect this for jwplayer cause am using this player for videos. I did research, checked this With an HTML5 video element on the iphone, how can I detect the difference between "pause" and "done"? but it doesn't worked for me.


Solution

  • There is no event listener for the done button. When the player is not fullscreen and in a paused or idle playback state, the user is no longer watching video:

    jwplayer().getFullscreen() // returns false
    
    jwplayer().getState() // returns "paused" or "idle"
    

    You could try listening for the fullscreen event and checking the state:

    jwplayer().on('fullscreen', function(e) {
        console.log('fullscreen changed:', e.fullscreen, 'state:', this.getState());
    });
    

    For the paused button, prior to version 7.2 jwplayer did not forward paused events from the video tag. This issue has been fixed.

    jwplayer().on('pause', function(e) {
        console.log('paused fullscreen:', this.getFullscreen());
    });