Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ppc_michael

Guest
Original poster
Apr 26, 2005
1,498
2
Los Angeles, CA
I'm making an experimental HTML5 video player. For now, I'm just using an <input type="range"> for the seek bar. To make this work, I'm using two event listeners:

Code:
video.addEventListener("timeupdate",updateSeekBar,false);
seekbar.addEventListener("input",seekToTime,false);

Now my problem is that I'm getting a loop. When the video fires the 'timeupdate' event, it runs updateSeekBar() to change my seek bar's value. But once the seek bar's value is changed, it runs seekToTime() to seek the video to the seekbar's time, and then it loops.

(So essentially, the video progresses and updates the seek bar, and the seek bar says "I'm updated" and seeks the video, and repeat.)

I was under the impression that the "input" event isn't supposed to be fired if it's changed via Javascript? What should I do?

EDIT: Instead of using an event listener for input changed, I'm using onChange(), and that seems to be working. Problem averted!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.