1

I'm using bigvideo.js and want to use a div that when clicked pause or play the player.

How can I toggle that on first click it pauses, then if click again played and so on...

jQuery('#bigvideo-pause').on('click', function() {
    BV.getPlayer().pause();
    BV.getPlayer().play();
});
Pranav C Balan
  • 110,383
  • 23
  • 155
  • 178
codek
  • 333
  • 4
  • 19
  • 48

1 Answers1

3

Use a boolean variable to toggle

jQuery('#bigvideo-pause').on('click', function() {
    BV.getPlayer()[this.play ? 'pause' : 'play']();
    this.play = !this.play;
});
Pranav C Balan
  • 110,383
  • 23
  • 155
  • 178