Here's what you need to know to make a good scrubber for progressive download
FLVs.
1. You need a background that shows the entire width of the bar.
2. You need a progress bar that shows how much of the video has loaded. The
width of this bar is the background.width * (ns.bytesLoaded / ns.bytesTotal);
3. You need a playback bar or shuttle which is updated on a timer. The width
(bar) or position (shuttle) is the background.width * (ns.time /
ns.metaData.duration).
4. You put the mouse events on the progress bar. On press, you set a flag that
you're seeking (so the update doesn't move the bar/shuttle but does keep the
progress bar updated), you pause the video, and you start a timer that calls an
update function. In the update function, you track the mouseX and constrain the
value (via Math.min and Math.max) to values between 0 and the progress bar
width, to which you set the position of the shuttle or width of the playback
bar. You take the position/width of the bar, divide it by the background.width,
multiply that by the duration of the ns, round it, and that's your seek time.
When you release, you unpause the video (assuming the video was playing when you
pressed, you'll need to keep a separate flag for that).
If you do it like I've described, then the dragging is always constrained by the
current loaded amount, not the loaded amount at the time you pressed, and you
don't get that ugly stutter when you stay in one place (there's no reason to not
pause the video when scrubbing).
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders