Solved

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

Posted on 2011-09-22
11
1,162 Views
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?

Thanks,
FJ0
0
Comment
Question by:FJ0
  • 5
  • 4
11 Comments
 
LVL 29

Expert Comment

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

Author Comment

by:FJ0
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.
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36713692
Is that possoble to upload your sample and I will improve?
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

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

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

Thank
private function netStatusHandler1(event:NetStatusEvent):void 
			{ 
				trace(event.info.code);
				switch(event.info.code) {
					case "NetConnection.Connect.Success":
						if (event.info.code == "NetConnection.Connect.Success")
						{
							if (event.info.secureToken != null)
								nc1.call("secureTokenResponse", null,
									TEA.decrypt(event.info.secureToken, "****"));
						}
						
						
						ns1 = new NetStream(nc1);
						ns1.bufferTime = bufTime;
						
						ns1.play(stream1);
						ns1.client = nsClient1;
					
						
						minorVideo = new Video();
						minorVideo.deblocking =1;
						minorVideo.smoothing = false;
						minorVideo.attachNetStream(ns1);
						uicMinor.addChild(minorVideo);
						//ns1.pause();
						nc1Connected = true;
						delayPauseTimer1.start();
						break;
					
					case "NetConnection.Connect.Failed":
						connectionError();
						break;
				}
			}

//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 {
			trace("delayPause1");
				ns1.pause();
			}

Open in new window

0
 
LVL 29

Expert Comment

by:dgofman
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
0
 

Author Comment

by:FJ0
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.
0
 
LVL 29

Expert Comment

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

http://help.adobe.com/en_US/FlashLite/2.0_FlashLiteAPIReference2/WS5b3ccc516d4fbf351e63e3d118d1ff34e3-7f05.html

0
 

Accepted Solution

by:
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.
0
 

Author Closing Comment

by:FJ0
ID: 36915563
none
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
Viewers will learn how to turn a Live Set into a compressed Live Pack file, and how to install Live Packs. Make: File > Collect All And Save: File > Manage Files: Click Manage Project: Click Create Pack: Select save location: Install: Doub…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

776 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