header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Shridhar Kulkanri
Points:0
Posts:0

1/11/2011 4:28:34 AM

Title: About video group chat with flex item renderer and fms


Hello All,
I am working on group video chat application...
before this i worked on 1 to 1 video chat application with flex and fms

I need Help on how to do group video chat Application using item renderer in flex and fms?????



1
Tyler
Points: 430
Posts:0
1/12/2011 6:00:05 AM



there is no special concept to create a group conferencing application using FMS and flex. Its basically similar to One to One application. A group conferencing application is a little more complex. In case of 1 to 1 we publish 1 video is published and 1 video is received at each user.

In case of multi user conference say we have 3 users then it would be like this:

User1 Publishes video and receives from User2 and User3
User2 Publishes video and receives from User1 and User3
User3 Publishes video and receives from User2 and User1

2
Shridhar Kulkarni
Points: 0
Posts:0
1/12/2011 6:19:06 AM



Thank You Tyler.

But how to do it with item renderer?
As i am having itemrenderer component in which there is video and one label component
When ever user logs in array get filled which i passes to item renderer and it will get display in item renderer automatically
So now,
Whenever i click user label then his camera should be display. and when i click to my own name my camera shud on

I am posting my code after this its giving me error of "net connection not be null"

Please help me i m already working on it from last 2 days

Please post early


3
Shridhar Kulkarni
Points: 0
Posts:0
1/12/2011 6:28:03 AM




import com.gc.groupChat.model.GCModelLocator;
			
			import flash.sampler.NewObjectSample;
			
			import mx.controls.Alert;
			import mx.managers.PopUpManager;
			import mx.utils.ObjectUtil;
			
			protected var camera:Camera;
			
			private var nc:NetConnection = null;
			private var microphone:Microphone;
			private var nsPublish:NetStream = null;
			private var nsPlay:NetStream = null;
			
			NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
		
			[Bindable]
			private var videoContainer1:Video = new Video(104,104);
			
			[Bindable]
			private var videoContainer2:Video = new Video(104,104);
		   
			
						
			private function nameLabelClickedHandler():void
			{
	             if(data.toString()== "myusername")(myusername iss stored in model which is unique and stream is done with that)
				 {
                                 /*username iss stored in model which is unique and stream is done with that*/
					
                                   onMyCamera();
				 }
				 else
				 {
					
					 playUserCamera();
				 }
			}
			
			
			 private function onMyCamera():void
			{
                                      /*my camera is working*/
				
				camera = Camera.getCamera();
				microphone = Microphone.getMicrophone();
				
				if(camera)
				{	
					
					camera.setMode(320, 240, 30, true);
					camera.setQuality(0, 75);
					camera.setKeyFrameInterval(24);
					microphone.rate=11;
					videoContainer1.clear();
					videoContainer1.attachCamera(camera);
					UIComponentVideo1.addChild(videoContainer1);
					
				}	
				doConnect();
					
			} 
				
			
			public function doConnect(event:Event = null):void 
			{
				if (nc == null) {
					
					nc = new NetConnection();
					nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
					
					var client:Object = new Object();		
					client.onBWDone = function():void
						client.onPlayStatus = function():void		
						nc.client = client;
						nc.connect("rtmp:/VideoGroupChat");
						
				} else 
				{
					if (nsPublish != null) {
						nsPublish.attachCamera(null);
						nsPublish.attachAudio(null);
					}
					nsPublish = null;
					
					if (nsPlay != null) {
						nsPlay.attachCamera(null);
						nsPlay.attachAudio(null);
					}
					nsPlay = null;
					
					videoContainer1.attachCamera(null);
					videoContainer1.clear();
					
					
					nc.close();
					nc = null;
					
					
					
				}
				
				
				function netStatusHandler(infoObject:NetStatusEvent):void {
					
					if (infoObject.info.code == "NetConnection.Connect.Failed") {
						
						nc = null;
						
					} else if (infoObject.info.code == "NetConnection.Connect.Rejected") {
						
						nc = null;
						
					} else if (infoObject.info.code == "NetConnection.Connect.Success")
					{
						videoContainer1.clear();
						videoContainer1.attachCamera(camera);
						publish();
                                               /*  when connection sucess*/
						
						
						
						if (infoObject.info.secureToken != undefined)
							nc.call("secureTokenResponse", null, null);
						
						
						
						
						
						
					} else if (infoObject.info.code == "NetConnection.Connect.Closed") {
						
					}
				}
			}
			
			
			
			
			private function playUserCamera():void
			{
			
				nsPlay = new NetStream(nc);
				nsPlay.addEventListener(NetStatusEvent.NET_STATUS, netStreamStatusHandler);
				
			
				nsPlay.play(data.toString());// a label name of user 
				videoContainer2.attachNetStream(nsPlay);
				UIComponentVideo1.addChild(videoContainer2);
				
				
			}
			
			
			
			public function publish():void 
			{
				nsPublish = new NetStream(nc);
				nsPublish.addEventListener(NetStatusEvent.NET_STATUS, netStreamStatusHandler);
				
				// set the buffer time to zero since it is 
				nsPublish.bufferTime=0;		
				// attach the camera and microphone to the server
				nsPublish.attachCamera(camera);
				nsPublish.attachAudio(microphone);
				nsPublish.publish( "myusername","record");
				
			}		
			
			public function netStreamStatusHandler(event:NetStatusEvent):void 
			{
				//output.htmlText += "<BR>NetStatus: " + event.info.code;
				if (event.info.code == "NetStream.Seek.Failed" || event.info.code == "NetStream.Play.Failed") {
				} else if (event.info.code == "NetStream.Play.Start") {
					
				} else {
				}
			}



<mx:VBox width="100%" height="100%">
		
		
		<s:BorderContainer width="104" height="104" backgroundColor="black" cornerRadius="5">
			<mx:UIComponent id="UIComponentVideo1"  />
		</s:BorderContainer>
		<mx:Label  text="{data}" textAlign="center" left="30" color="blue" click="nameLabelClickedHandler();" />
	</mx:VBox>


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 4+8 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions