Take the 2-minute tour ×

Here's my use case:

I present a user with a set of small playing videos. When the user clicks on one of the small videos, I pause all the small ones and load a higher bitrate version of the video that was clicked.

That all works fine, except it's really slow and some network diagnostics suggest the problem is all the small videos continue to load even though I've called pause() on their netstreams.

To rephrase in code:

Suppose I have:

var nc:NetConnection = new NetConnection();
nc.connect (null);   

var ns1:NetStream = new NetStream(nc);        

var vid1:Video = new Video(WIDTH, HEIGHT);

a few seconds go by... vid1 is still loading, and what I want to do is pause both the video stream of vid1 as well as the network traffic of loading vid1 so that the following code can run as quickly as possible


var ns2:NetStream = new NetStream(nc);
var vid2:Video = new Video(WIDTH, HEIGHT);

... and then some time later the user dismissed vid2, so I resume playback of vid1


Is there some way to tell ns1 to stop from reading its socket? If I call ns1.close(), then I can't resume playback with ns1.resume().

If I need to use a streaming protocol, how heavy is the handshake when loading all the small videos? I'm trying to load lots of low bitrate (50kbps) videos quickly.


share|improve this question
add comment

1 Answer

The problem is that the movies continue to load, even though they are not playing. You can easily see that on YouTube: Just click a video and then hit pause - the progress bar continues to grow.

I believe there is no other way to stop this but to close each NetStream when it is paused. Accepting a slight delay and/or a jump to the next adjacent key frame, you can continue the movie at the last position, though: The video object the stream is assigned to should still display the last frame until there is new content, or video.clear() is called, and you can store the last playing position using ns.time and return to it after you reconnect using ns.seek ().

share|improve this answer
Thanks, that worked well! –  jseims Jan 9 '11 at 23:33
You're welcome. You could accept this answer to repay me... ;) –  weltraumpirat Jan 9 '11 at 23:56
add comment

Your Answer


