Page 1 of 1

client and send() method

Posted: 20 Dec 2012, 10:57
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

Re: client and send() method

Posted: 21 Dec 2012, 09:10
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?

Re: client and send() method

Posted: 21 Dec 2012, 11:20
by PePPeR
Thank you. I found a lot of threads about problem with send method in Red5.