W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2008

[whatwg] Video Element Events? - Use Case: Custom Progress Bar

From: Jeremy Doig <jeremydo@google.com>
Date: Mon, 17 Nov 2008 14:02:29 -0800
Message-ID: <35c92870811171402j4ae369a3ld4edf8ff03d3421a@mail.gmail.com>
i would hope that repainting a progress bar that has not moved 50x/second
would not be a normal implementation too. 2x/second seems more realistic (a
300s video with a 600 pixel-wide playbar).

On Mon, Nov 17, 2008 at 1:23 PM, Robert O'Callahan <robert at ocallahan.org>wrote:

> On Tue, Nov 18, 2008 at 8:48 AM, Jonas Sicking <jonas at sicking.cc> wrote:
>
>> It seems like a pretty big waste of resources to have the following script
>> executing 50 times per second:
>>
>> function timeupdatehandler(e) {
>>  video = e.target;
>>  completed = video.currentTime / video.duration;
>>  thumb = document.getElementById('thumb' + video.id);
>>  thumb.style.left =
>>    calcScreenPositionUsingOffsetLeftRecursion(thumb.parentNode) +
>>    thumb.parentNode.offsetWidth * completed;
>>  progress = document.getElementById('progress' + video.id);
>>  progress.style.width =
>>    progress.parentNode.offsetWidth * completed;
>> }
>>
>> Sure, we can pull it off, but why do it? At it certainly doesn't seem to
>> archive the goal of the event which apparently is to reduce the amount of
>> CPU resources used.
>
>
> It ensures that the UI is always perfectly up to date. We can throttle
> timeupdate if we get too busy but otherwise, we may as well update the UI as
> frequently as the video rendering itself.
>
> Rob
> --
> "He was pierced for our transgressions, he was crushed for our iniquities;
> the punishment that brought us peace was upon him, and by his wounds we are
> healed. We all, like sheep, have gone astray, each of us has turned to his
> own way; and the LORD has laid on him the iniquity of us all." [Isaiah
> 53:5-6]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20081117/bf2bd39e/attachment.htm>
Received on Monday, 17 November 2008 14:02:29 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:07 UTC