Search code examples
ipadjwplayerjwplayer7

How to pause JW Player on Ipad without controls


JW player, if you hide the control bar you can click the video to play and pause, this works fine in desktop.

When I tested this in ipad it plays but touching it again doesn't pause the video.

Verify with this URL, https://support.jwplayer.com/customer/portal/articles/1406723-basic-video-embed

**Dont use the control bar as I need it disabled.


Solution

  • If you hide the JW controls, then the player should also not react to clicking on the video as a means to start/stop unless you specifically add code to tell it to.

    For this to happen you need to attach a function to the onDisplayClick event listener as follows:

    **JW6 version**
    jwplayer().onDisplayClick(function(){
        jwplayer().play();
    });
    
    **JW7 version**
    jwplayer().on('displayClick',function(){
        jwplayer().play();
    });
    

    Just calling the play() method in this way will handle the toggle of play/pause states - you don't need to manage this yourself.