Archive for February 2012

Trouble with HTML5 video

I’ve been playing with the HTML 5 video tag. I’m trying to get an accurate reading of the frame that the movie is on when it is paused. I’d also like to play the movie until it reaches a certain frame, then pause it.

It seems like both of these tasks are hard using HTML 5 video. You can only ever get the “currentTime” of the movie, which gives you progress in seconds, not frames. With about an hour of experimentation, it proved difficult to translate the time into a frame number in a robust and repeatable fashion.

Also, there is a event fired by the video object called “ontimeupdate”, which I thought I could use to measure if the video had progressed past a certain point, and if so pause the video. It turns out the event is only fired every 0.250 – 0.350 seconds on my testing machine (i7 iMac). This is too infrequent to be very helpful for stopping at a specified frame. I guess you need about 1/(2*frame_rate) seconds between events to be frame-accurate.

For all the things that the web does well, I think audio and video are still fairly new tech. New audio and video APIs are required.

Has anyone got any experience with precisely controlling web video? Can you suggest another approach?