title: to add event listener for getting video duration in run time in videojs
body: <p>I want to monitor the video duration as the video plays using any event listener. I am using <code>videojs</code> for video playback. </p>
  
  <p>I came across events like <code>play</code>, <code>myplayer.isPaused</code> but they fire only once. 
  <code>myplayer</code> is the video element for <code>videojs</code>. 
  Now upon further research i got an event named  <code>on</code>. 
  So here goes the code : </p>
  
  <pre><code>myPlayer.on("play", myfun);
  
    function myfun() {
      console.log("myPlayer.currentTime()");
      console.log(myPlayer.currentTime());
      myfun();
    }
  </code></pre>
  
  <p>Here is what i expected that it will give me <code>currentTime</code> as you can see i am calling <code>myfun</code> recursively.
  But this function is getting called a million times but only gives me the starting time which is <code>0</code>. </p>
  
  <p>I even tried to put <code>myPlayer.currentTime()</code> in <code>setInterval</code>, but this method is not trustworthy and ofcourse not a good idea.</p>
  
  <p>I used native javascript eventlisteners but they are not likely to be useful. </p>
  
  <p>So any help to attach event listener for the videoplayback sothat i would get the play duration? </p>