I want to execute a JavaScript function every second, or whenever the time position changes on a Mobile Safari video player during playback.
Is there an event listener or some way of achieving this? I see how to do it on-demand here:
In Safari for iPad, how can I get the current video position via Javascript?
However, I’m looking for a way to fire the function automatically instead of requiring user interaction to trigger getting the position. Can this be done?
There’s a ton of events you can hook into with HTML5 video. Not all will be supported by every browser, but Mobile Safari should do a pretty good job with what you need for this, which is the “timeupdate” event.
You can see a demonstrator for the events here:
http://www.w3.org/2010/05/video/mediaevents.html