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

Hello,

(Sorry if this has come up before and I missed it.)

I was looking over the spec and looking to see how I'd go about creating a
custom "progress bar".  (Like you see as part of "scrub bars".)

To do this I'd imagine that a playing video would have to "send out" events
"fast enough" so that the progress bar could be updated "enough".

Perhaps I didn't read the spec carefully enough, but I don't see any such
event.

I'd expect to be able to do something like...

videoElem = document.getElementById("aVideoElement");

videoElem.addEventListener( "moment",
function()
{
    // Handle the event.
    // I.e., update the progress bar or something.
    //
    // I'll need a way to know a what point in time the video is at now.
}
,false);

Note I used the fictitious "moment" event.  (I doesn't have to be called
"moment".  I just made up something.)

*Is there anything like this already?*


Or do you just set up a timer and poll the "currentTime" attribute.

I.e., something like...

function updateProgressBar(id)
{
    videoElem = document.getElementById(id);

    // Update the progress bar using: videoElem.currentTime
}

setTimeout("updateProgressBar(\"aVideoElement\")", 100);


I suppose the advantage of the polling method is that you can specify how
often you do the update.  But it doesn't seems to make for poorer developer
usability.


-- 
Charles Iliya Krempeaux, B.Sc.
http://ChangeLog.ca/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20081028/6719c69b/attachment.htm>

Received on Tuesday, 28 October 2008 21:22:44 UTC