Flex 4.5 Video, NetStream, Start Buffering after calling ns.togglePause in NetStatus Handler to prevent autoplay

Posted on 2011-09-22
Last Modified: 2013-12-07
I'm working on a video player built on the Flex Framework. I'm using NetConnection, NetStream to stream from a wowza server.

I do not want the video to autoplay when loading. The only way I found to prevent this is by calling ns.togglePause() in the netStatusHandler. this works fine. However I would like to start the buffering right away. the only way I've found is to delay the initial pause in the netStatusHandler by 3 seconds, with a timer. This works but is a little dirty as the video sometimes plays a bit before the pause. But the video continues to buffer when paused, this is the behavior I'm looking for. I wish to accomplish this without using a delay to call ns.togglePause.

Is there a way to force buffering after calling ns.togglePause() in the netStatusHandler?

Question by:FJ0
  • 5
  • 4
LVL 29

Expert Comment

ID: 36713638
Sorry, I missed your post did you resolve your problem?

Author Comment

ID: 36713686
No, I have not found the exact behavior i was look for. But I have got it working a bit better. I just wish I was able to start the stream, in the pause state and start the buffering. I have to let it play a second or two or the buffer will stop. guess i would need to subclass netStream if that's possible.
LVL 29

Expert Comment

ID: 36713692
Is that possoble to upload your sample and I will improve?

Author Comment

ID: 36713729
basically this is what i'm doing:

any ideas, or secret documentation let me know...

private function netStatusHandler1(event:NetStatusEvent):void 
				switch( {
					case "NetConnection.Connect.Success":
						if ( == "NetConnection.Connect.Success")
							if ( != null)"secureTokenResponse", null,
									TEA.decrypt(, "****"));
						ns1 = new NetStream(nc1);
						ns1.bufferTime = bufTime;
						ns1.client = nsClient1;
						minorVideo = new Video();
						minorVideo.deblocking =1;
						minorVideo.smoothing = false;
						nc1Connected = true;
					case "NetConnection.Connect.Failed":

//timer is set as so

private var delayPauseTimer1:Timer = new Timer(1000, 1);

//then this is the timer function

	private function delayPause1(evt:TimerEvent):void {

Open in new window

Free camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

LVL 29

Expert Comment

ID: 36714019
You can solve your problem easily by set volume to zero and storing last play position.  So, when user clicking on play button you will seek to last position and setting volume to one. As soon as user will click on pause set volume back to zero

Author Comment

ID: 36714062
How would that help. maybe you don't understand. I wish to pause (prevent autoplay) when a stream is established. so on the netStatus handler event I call. ns.pause (or ns.togglePause). However the stream stops unless I let it play a bit then call ns.pause, and the buffer continues to store the stream, while it's paused, as the documentation states. I have no issues with the sound. Thanks anyways.
LVL 29

Expert Comment

ID: 36817533
can you try instead play use seek to the end movie ns.time intead play than pause


Accepted Solution

FJ0 earned 0 total points
ID: 36895421
how would that help starting the stream into the buffer in the pause state? Yes i know about seek i using it. Are you an expert? this site is a joke... Maybe if you were to learn better English you might understand that I've found a workaround right away and would just like to find a cleaner way. They actually find ppl to pay to ask questions! maybe next you can suggest me to change the color of a button. Really! come on guy, all the things you have suggested are completely unrelated to the question. apparently there seems to be a problem in the framework itself, as im  not getting the behavior that on would expect after reading the documentation, possibly it on the server side and I should ask the question on the wowza forums, or maybe try the application with a FMS sever to prove this theory myself. please drop it dgofman. you dont get it. your no expert in my opinion. thanks.

Author Closing Comment

ID: 36915563

Featured Post

Give your grad a cloud of their own!

With up to 8TB of storage, give your favorite graduate their own personal cloud to centralize all their photos, videos and music in one safe place. They can save, sync and share all their stuff, and automatic photo backup helps free up space on their smartphone and tablet.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to convert mp3 to wav 1 413
SPOTIFY - What is the Syncing Mechanism? 3 73
Need help using Audio Cutter 4 56
Does Android x86 support RTSP stream in Xibo Client? 13 101
I have been fiddling with (oops, I mean evaluating) media players for over a year now.  I purchased a D-Link DSM-520 about a year ago and was pleased with how many file formats It could play, but I found the user interface to be on the clunky side. …
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
Viewers will get an overview of how to make and use Drum Racks in Ableton Live. Load new Drum Rack into empty MIDI track: Fill rack with audio samples: Re-arrange sample slots as necessary: Adjust parameters of each slot to tailor each sound a…
Viewers will learn how to use Macros for greater control over Rack parameters in Ableton Live. Group devices into a Rack by selecting them and pressing Command-G (Ctrl-G on PC): Control-click (Right Click on PC) a parameter to access pop-up menu, …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now