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

Jeremy Doig jeremydo at google.com
Mon Nov 17 14:02:29 PST 2008


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-0001.htm>


More information about the whatwg mailing list