1 Reply Latest reply on Feb 22, 2013 9:48 PM by Expirtion

    How  to automatically alter  rtmp /rtmfp  connections

    Expirtion

      Hi ,there!   I'm developing  a real-time game project . First , i wanna  use rmtfp  to do the video/audio communication so that i can save a lot bandwidth . when  A scrible B  and publish Astream, and B scrible A and publish Bstream.  how do i know if they(A and B) are connected,then give them both a hint ? if connected .,then how do i know the delay status between them ? if the delay latency is more than 5 seconds, then i 'll think about using rtmp to connect. Any one can help ?

        • 1. Re: How  to automatically alter  rtmp /rtmfp  connections
          Expirtion Level 1

          private function netConnectionHandler(event:NetStatusEvent):void

             {

              status("NetConnection event: " + event.info.code + "\n");

             

                       switch (event.info.code)

                       {

                           case "NetConnection.Connect.Success":

                            connectSuccess();

                               break;

                              

                              case "NetConnection.Connect.Closed":

                               currentState = LoginNotConnected;

                               break;

                              

                              case "NetStream.Connect.Success":

                               // we get this when other party connects to our outgoing stream

                               status("Connection from: " + event.info.stream.farID + "\n");

                               break;

                              

                              case "NetConnection.Connect.Failed":

                               status("Unable to connect to " + connectUrl + "\n");

           

                             // swift the rtmp mode

           

                             changeRTMP();

                               currentState = LoginNotConnected;

                               break;

                        }

                    }

           

          private function connectSuccess():void

             {

              status("Connected, my ID: " + netConnection.nearID + "\n");

                         

                          // exchange peer id using web service

              idManager = new HttpIdManager();

              idManager.service = WebServiceUrl;

             

                         idManager.addEventListener("registerSuccess", idManagerEvent);

                         idManager.addEventListener("registerFailure", idManagerEvent);

                         idManager.addEventListener("lookupFailure", idManagerEvent);

                         idManager.addEventListener("lookupSuccess", idManagerEvent);

                         idManager.addEventListener("idManagerError", idManagerEvent);

                        

                         idManager.register(userNameInput.text, netConnection.nearID);

             }

           

          private function changeRTMP(){

           

          }

           

           

           

          when the case    NetConnection.Connect.Failed    i could change to rtmp mode ,but if  NetConnection.Connect.Success .  how do i know the delay seconds between A and B . then i can find the optimun way (rtmp/rtmfp