Periodic event in popcorn.js

136 views Asked by At

How can popcorn.js be configured to emit event every time there's update in time of the video? Should I just use the timeupdate event of the video element then?

Currently, I could only setup event at a specific start time:

var p = Popcorn( "#video" )
      // play the video
      .play()
      // set the volume to zero
      .volume( 0 )
      .code({
        start: 1,
        end: 3,
        onStart: function( options ) {         
          document.getElementById( "test1" ).innerHTML = "Yes";
        },
        onEnd: function( options ) {
          document.getElementById( "test1" ).innerHTML = "No";
        }
     })
1

There are 1 answers

2
Prabodh M On BEST ANSWER

From the official Docs it says you capture event everytime the player time is updated

var pop = Popcorn("#video");

pop.on("timeupdate", function( e ) {
    console.log( "timeupdate fired!");
});

pop.play();