Hello.
On smartphones if you tap on video it just showing controls so you need to tap second time on the controls to play/pause. Is there any way to video.js player act similar on mobile as on desktop. One tap on video (not controls) play second tap pause?
You probably can add this functionality by listening to the click event on the player and then toggling playback.
Hope that helps.
I actually want the "touch" event of mobile.Should I add it to the player('#player-id')?
You should still be getting a click event on mobile as well, but you can also listen to the tap event we trigger.
Yeah, it's basically just:
var player = videojs('#player-id');
// can also be `tap` or `touchend` or some other event instead of `click`
player.on('click', function() {
if (player.paused()) {
player.play();
} else {
player.pause();
}
});
click and tap events are not fired on android (only tested with android v8)
tap event only display controlbar.
Is there a a way to override tap event managed by player ?
UPDATE : touchstart event is well fired
FYI, my goal is to enable play/pause when tap on video
Most helpful comment
click and tap events are not fired on android (only tested with android v8)
tap event only display controlbar.
Is there a a way to override tap event managed by player ?
UPDATE : touchstart event is well fired
FYI, my goal is to enable play/pause when tap on video