Progress Bar for QuickTime Movies
Date: Tue, 20 Jun 1995 13:54:15 -0800
From: KEVIN BAIRD <kevin_baird@QMAIL.LIGHTSPAN.COM>
Subject: digital video progress bar
Yes, I've recently done something like that. This lingo controls movieRate
instead of movieTime of a QuickTime movie, which is what you want. But it
should be pretty similar. The dragBall handler is called by a click
(mouseDown) on both the "thumb" and the line the thumb is constrained to, and
it's pretty responsive. The position of the ball is determined constantly by
whatever the current movieRate is, and the movieRate is affected immediately
by dragging the ball. I haven't tested it with high datarate movies, though.
The fun part is that it's really easy to modify the min and max values of the
rate, and that moving the controller doesn't break it, because there are few
numbers hard-coded in. It uses a (unoptimized) linear funtion to convert from
pixels to rates and back. (I even made the sprite numbers global because I was
rearranging it on the score a bunch, and got tired of changing 3s to 2s and so
on.) The setBall handler is called by Play (setBall 1) and Pause (setBall 0)
buttons. A backwards button would be setBall -1. Hope it helps.
on setMooVSpeed newRate
global gsMooV, gsSlider, gsBall
set the movieRate of sprite gsMooV to newRate
set the text of cast "fSpeed" to string(integer(newRate * 100)) & "%"
end setMooVSpeed
on dragBall
-- drag ball to determine and set movieRate
global gsMooV, gsSlider, gsBall
repeat while the stillDown
-- drag the ball
set ballLoc to constrainH(gsSlider, the mouseH)
set the locH of sprite gsBall to ballLoc
updateStage
-- figure the new speed
set scale to 4.0 -- 0 to 4
set slope to scale / (the width of sprite gsSlider)
set newRate to slope * (ballLoc - (the left of sprite gsSlider))
setMooVSpeed newRate
end repeat
-- updateStage
end dragBall
on setBall newRate
-- click something that sets movieRate, then update ball.
global gsMooV, gsSlider, gsBall
set the locH of sprite gsBall to (the left of sprite gsSlider) + newRate * (the width of sprite gsSlider) / 4.0
setMooVSpeed newRate
end setBall