• Resolved tzanou

    (@tzanou)


    hello i just need to know if its possible to play the player on click in an element of my page with jquery or javascript
    thanks by advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • With jQuery you can use this example code:
    $(‘#playPause’).click(function () {
    if ($(‘.video-js’).get(0).paused) {
    $(‘.video-js’).get(0).play();
    } else {
    $(‘.video-js’).get(0).pause();
    }
    });

    Your button must have the ID=”playPause”

    Thread Starter tzanou

    (@tzanou)

    Hello thanks dude your response help me but with your plugin i had to change .videojs by .vjs-tech so for someone else who want to do that you have to do like this :

    $(‘#playPause’).click(function () {
    if ($(‘.vjs-tech’).get(0).paused) {
    $(‘.vjs-tech’).get(0).play();
    } else {
    $(‘.vjs-tech’).get(0).pause();
    }
    });

    Your button must have the ID=”playPause”

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘play player when click on a button’ is closed to new replies.