- From: Robert O'Callahan <robert@ocallahan.org>
- Date: Tue, 18 Nov 2008 10:23:08 +1300
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/20081118/26cb9f91/attachment.htm>
Received on Monday, 17 November 2008 13:23:08 UTC