title: Youtube Iframe API: trigger function on particular getcurrenttime()
body: <p>I'm trying to trigger function(s) when <code>player.getCurrentTime() == 10</code> sec (and many more intervals like this).</p>
  <p>I can do this with JS timing events but it's not accurate and slows my browser very much..</p>
  <p>Is there an alternate?</p>
  <p>Current code:</p>
  <pre><code>trigFuncAt = Array(3, 5, 7, 10);
  setInterval(checkFunc(), 200);
  
  function checkFunc(){
      if( include( trigFuncAt, player.getCurrentTime() ) ){
          DoThis();
      }
  }
  
  function include(arr,obj) {
      return (arr.indexOf(obj) != -1);
  }
  
  function DoThis(){...}
  </code></pre>
  <p><code>player.getCurrentTime()</code> is a timer kind of variable it changes for every ms.</p>
  <p>YT API: <a href="https://developers.google.com/youtube/iframe_api_reference" rel="nofollow noreferrer">https://developers.google.com/youtube/iframe_api_reference</a></p>