[whatwg] What is the purpose of timeupdate?

Silvia Pfeiffer silviapfeiffer1 at gmail.com
Sat Nov 7 21:41:52 PST 2009


On Sat, Nov 7, 2009 at 7:21 PM, Justin Dolske <dolske at mozilla.com> wrote:
> On 11/7/09 3:21 PM, Jonas Sicking wrote:
>
>> When timeupdate was added, the stated goal was actually as a battery
>> saving feature for for example mobile devices. The idea was that the
>> implementation could scale back how often it fired the event in order
>> to save battery.
>>
>> Now that we have implementation experience, is timeupdate fulfilling
>> this goal? If not, is it fulfilling any other goals making it worth
>> keeping?
>
> FWIW, I felt that having Firefox's default video controls update their state
> for every frame was excessive (and could lead to competing for the CPU with
> the video itself). So, the controls basically ignore timeupdate events that
> occur within .333 seconds of the last timeupdate position... Which leads to
> having a bit of complication to deal with edge cases like having the video
> end less than .333 seconds after the last timeupdate event (otherwise the UI
> might look like stuck shortly before the end of the video).
>
> At least for my needs, having an event fire at ~3 Hz (and when special
> things happen, like a seek or the video ending) would be somewhat simpler
> and more efficient.

I use timeupdate to register a callback that will update captions/subtitles.

The alternative is to use the setInterval (or setTimeout) function
which checks regularly whether your video's currentTime is still
within your subtitle element.

I think timeupdate is very useful, in particular since it is more
accurate than checking currentTime.

But I also think we need to add another mechanism to register events
with the video/audio element that are triggered at the registered time
(or within an interval). This would avoid constant polling for
captions.

At TPAC in the video breakout group we discussed a little how to
re-introduce something like cue ranges in the context of captions in a
declarative manner. We still need to make this more concrete, but it
may be similar to the onenter and onleave events that the itextlist
element has in https://wiki.mozilla.org/Accessibility/HTML5_captions_v2
.

Cheers,
Silvia.



More information about the whatwg mailing list