Skip to main content
Inspiring
October 20, 2006
Question

Streaming Video Progress Bar

  • October 20, 2006
  • 5 replies
  • 1573 views
I need to create a progress bar for my streaming video to let the user know how much of the video has already been downloaded/streamed. Making a progress bar for a progressive download is easy, just check the bytesLoaded vs the bytesTotal. But apparently with a streaming video those do not work. What exactly do I need to check in order to create a progress bar for a streaming video. Here is my sample code that doesn't work for the progress bar.
This topic has been closed for replies.

5 replies

Known Participant
August 26, 2009

I have the same problem. How does one show the download progress for a streamed video suing Flash Media Server 3 & ActionScript 3? I know that  ns.bytesLoaded/ns.bytesTotal only works with progressive download so it's of no use and ns.bufferLength/ns.bufferTime keeps returning a fluctuating value which is certainly not indicating download progress.

I'm starting to think that there is no way to display download progress of a streamed video at all. Can that be the case?

Participating Frequently
October 20, 2006
I would assume that you are using NetStream then. You should be looking at

bufferTime
bufferLength

of the NetStream class.

Tim
Inspiring
October 23, 2006
Sorry for the lull in response, I was away from a computer all weekend. Anyways, I tried checking the bufferTime vs the bufferLength in my loader script but with no luck. My progress bar, which should only be 280px, starts out ridiculously long, much longer than the stage and xScales down until it gets to about the half way point of the loader then it starts xScaling in the correct direction. Once it fills the loader it shrinks back down to about the half way point and fills again and the process repeats. My loader code is attached below. You can also see my sample file here. Thanks for all your help thus far.

Inspiring
October 20, 2006
Code.
Participating Frequently
October 20, 2006
How are you playing the video? Is it a custom component or code?

Tim
Inspiring
October 20, 2006
Hi!

You might want to check out the video basics tutorials (8 of them in total)
at
http://www.gotoandlearn.com/

/Jensen/

"quovadimus02" <webforumsuser@macromedia.com> wrote in message
news:ehalfi$deh$1@forums.macromedia.com...
>I need to create a progress bar for my streaming video to let the user know
>how
> much of the video has already been downloaded/streamed. Making a progress
> bar
> for a progressive download is easy, just check the bytesLoaded vs the
> bytesTotal. But apparently with a streaming video those do not work. What
> exactly do I need to check in order to create a progress bar for a
> streaming
> video. Here is my sample code that doesn't work for the progress bar.
>
> var startingCheckX:Number = loader_mc.seek_mc._x;
> // updates loader bar as well as progress indicator
> function checkBytesLoaded() {
> amountLoaded = ns.bytesLoaded / ns.bytesTotal;
> loader_mc.bar_mc._width = amountLoaded * 280;
> loader_mc.seek_mc._x = startingCheckX + (ns.time / duration * 280);
> var minsElapsed:Number = Math.floor(ns.time / 60); // find number of
> minutes
> var secsElapsed:Number = Math.floor(ns.time % 60); // find remaining
> seconds
> var minsTotal:Number = Math.floor(duration / 60); // find total number of
> minutes
> var secsTotal:Number = Math.floor(duration % 60); // find total number of
> seconds
> // add leading zero for single digit values
> minsElapsed = (minsElapsed < 10) ? "0" + minsElapsed : minsElapsed;
> secsElapsed = (secsElapsed < 10) ? "0" + secsElapsed : secsElapsed;
> minsTotal = (minsTotal < 10) ? "0" + minsTotal : minsTotal;
> secsTotal = (secsTotal < 10) ? "0" + secsTotal : secsTotal;
> loader_mc.counter_txt.text = minsElapsed + ":" + secsElapsed + " / " +
> minsTotal + ":" + secsTotal;
> }
>
> loadedInterval = setInterval(checkBytesLoaded,100);
>


Inspiring
October 20, 2006
Thanks for the link but all those tutes deal with the basics of dealing with progressive videos. I'm trying to create a loading bar for a streaming video which is a bit different apparently.
Participating Frequently
October 20, 2006
The FLVPlayback componet has a bufferingBar piece that does what you are asking. The user can see the video window but you can use the following FLVPlayback properties to control the look and feel of the buffering bar.

FLVPlayback.buffering
FLVPlayback.bufferingBar
FLVPlayback.bufferingBarHidesAndDisablesOthers
FLVPlayback.bufferTime

Tim