
Using onTime() to run a function every 5 seconds?
Hey guys!
As the title says, I'm trying to run a function every 5 seconds using onTime(). I found this thread from a while ago:
http://www.longtailvideo.com/support/forums/jw-player/javascript-interaction/18350/how-to-the-change-the-frequency-of-the-ontime-event/
in which someone suggests using a counter to trigger an event only once. From that, I diddled together something like this:
bc.. JWP.onTime(function(event){
var time= Math.floor(event.position),
counter = 0;
if (time == counter){
counter+=5;
//blah blah code
}
});
Sorry if there are any syntax errors, I'm pretty new to this! Anyway, the problem is is that the code triggers more than once. I've been wracking my brains on this for quite a while now! Did I make a noob mistake? Is there a better way to do this? Cheers in advance for any help!