Sunny
Sunny

Reputation: 863

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.

Upvotes: 0

Views: 967

Answers (2)

jherrieven
jherrieven

Reputation: 425

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.

Upvotes: 2

Sunny
Sunny

Reputation: 863

I tried to do it in proper way but that doesn't seem to work alright, this is the only solution works for me,

$('.video-wrapper').on({ 'touchend' : 
                    function(){
                        if(dtjwplayer.getState() !== 'paused') {
                            dtjwplayer.pause(true); 
                        }
                    } 
                });

This is a very basic requirement where people wants to disable the control bar, Please let me know if there is any better way to do it.

Upvotes: 0

Related Questions