client and send() method

Post your questions and bug-reports about our audio/video streaming add-on based on Red5 Server.

Moderators: Lapo, Bax

Post Reply
PePPeR
Posts: 40
Joined: 24 Aug 2011, 18:16

client and send() method

Post by PePPeR »

Trying to used netStream.send method for indicate if user on or off microphone and activity of it.
But for some reason it doens't work.
sender code send is bound to button and microphone is perfectly attaching and detaching, but for some reason on reciever i don't see any action bounded to netStream.client, even traces and no errors.

Code: Select all

		private function mic_btn_down(evt:MouseEvent)
		{
				if (playerStreams[myPlayerID - 1] != null) 
				{
					(playerStreams[myPlayerID - 1] as NetStream).attachAudio(micSnd);
					(playerStreams[myPlayerID - 1] as NetStream).send("mic", { state: "on", pID: myPlayerID} );
					micSnd.addEventListener(ActivityEvent.ACTIVITY, micAct);
				}
		}
		private function mic_btn_up(evt:MouseEvent)
		{
				if (playerStreams[myPlayerID - 1] != null) 
				{
					(playerStreams[myPlayerID - 1] as NetStream).attachAudio(null);
					(playerStreams[myPlayerID - 1] as NetStream).send("mic", { state: "off", pID: myPlayerID} );
					micSnd.removeEventListener(ActivityEvent.ACTIVITY, micAct);
				}
		}
		private function micAct(evt:ActivityEvent)
		{
			(playerStreams[myPlayerID - 1] as NetStream).send("talk", { pID: myPlayerID, actLev:micSnd.activityLevel } );
		}
Receiver

Code: Select all

		public function initListener(id:int)
		{
			var obj:Object = new Object();
			obj.mic = onMicSC;
			obj.talk = onTalk;
			streams[id].client = obj;
		}
		private function onTalk(obj:Object)
		{
			//obj.pID
			//obj.actLev
		
			trace("pID: " + obj.pID + " _ actLevel: " + obj.actLev);
		}
		//On microphone state change
		private function onMicSC(obj:Object)
		{
			trace("!@microphon state oN_oFF @!");
			if (obj.state == "on")
			{
				trace("micOn: " + obj.pID);
				micOn(obj.pID-1);
			} else {
				trace("micOff: " + obj.pID);
				micOff(obj.pID-1);
			}
		}
i'm using AVCastManager from RedBox
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: client and send() method

Post by Bax »

This issue is not strictly related to SFS I suppose, because the RedBox API simply use the Flash API to connect to the media server.
Not sure how to help. Maybe you should investigate in some Flash support forum?
Paolo Bax
The SmartFoxServer Team
PePPeR
Posts: 40
Joined: 24 Aug 2011, 18:16

Re: client and send() method

Post by PePPeR »

Thank you. I found a lot of threads about problem with send method in Red5.
Post Reply