PDA

View Full Version : draggable progress bar for video


ninjapeps
02-27-2007, 02:47 AM
I've got a AS-controlled video object that plays FLVs from a server. everything already works fine but I'd like to be able to navigate through the loaded movie with the progress bar and I've managed this to some extent. for some reason, the movie will only ever jump to the nearest 5% increment of the whole movie (ex: in a 200 second movie, it always goes to the nearest 10). here's the code I used:

stream.seek(timer * this.slider_mc._x / 370);

stream is my NetStream object
timer is the total time of the movie in seconds
slider_mc is an object that tells me what point of the movie I'm in, in reference to the progress bar
370 is the total length of the progress bar

I've checked the values I've been getting for (slider_mc._x / 370) and all the values have been between 0 and 1 so I'm pretty sure that my equation is correct. is this just some weird behavior in the seek method?

<edit>
tried using specific values and it still jumps to the same increments. guess that's the way it really behaves. are there any more precise alternatives?
</edit>

ida
02-27-2007, 09:26 AM
seek() always seeks to the closest keyframe in the movie so make sure you have many keyframes in your flv.

Have you tried tracing the value you send to the seek function?

ida
02-27-2007, 09:28 AM
Also try this:

stream.seek(Math.round(timer * (this.slider_mc._x / 370)));

ninjapeps
02-28-2007, 08:06 AM
I used Math.floor and got the same results. it's probably the flv, then. thanks.