1 Reply Latest reply on Oct 19, 2011 3:04 AM by nikrv

    deliver RTMFP Stream into RTMP Stream

    nikrv Level 1

      how to deliver RTMFP stream into RTMP stream on server side ?

        • 1. Re: deliver RTMFP Stream into RTMP Stream
          nikrv Level 1

          this code deliver RTMFP stream into RTMP

           

          application.onPublish = function(client, myStream){

             

              trace("onPublish {");

             

              var nc = new NetConnection();

              nc.connect( application.urlRtmfpFallBack );

              nc.onStatus = function(info) {        

                  trace(info);

             

                  if (info.code == "NetConnection.Connect.Success")

                  {

                      var streamRoute =  new NetStream(nc, "G:01010103010c050e74657374210edd6a0c7c4a7b5e2ade5ad27c45c45d3adee2ac2d5d9137f0446e32e7a8 1e335000");

                      streamRoute.onStatus = function(info) {

                              trace(info.code);

                              if (info.code == "NetStream.Connect.Success")

                              {

                                  streamRoute.attach(myStream);

                                  streamRoute.publish("roma");

                              }

                          };               

                      trace("NetConnection.Connect.Success")

                  }

              };

             

             

              trace("onPublish }");

             

              trace ("---------------------onPublish------------------------");

                         

             

          };

           

          -------------------------------------------------------------------------

           

          Client.prototype.routeRtmfpStream = function()

          {

              trace ("---------------------routeRtmfpStream------------------------");

             

             

              var streamIngest = Stream.get("mp4:multicast-ingest.f4v");

             

              var ng;

              var nc = new NetConnection();

              nc.onStatus = function(info) {

                  if (info.code == "NetConnection.Connect.Success") {

                      ng = new NetGroup(nc, "G:01010103010c050e74657374210edd6a0c7c4a7b5e2ade5ad27c45c45d3adee2ac2d5d9137f0446e32e7a8 1e335000");

                      ng.onStatus = ngStatusHandler;

                  }

              };

              nc.connect(application.urlRtmfpFallBack);

              

              // Handle NetGroup status events; this simple example handles only the initial join.

              function ngStatusHandler(info) {

             

                  trace("ngStatusHandler=" + info.code);

             

                  if (info.code == "NetGroup.Connect.Success") {

                 

                      // As soon as we've successfully joined the Group,

                      // attempt to start ingesting a multicast stream.

                      // Assume we know the stream name we want to ingest (sourceStreamName).

                     

                      var ingest = ng.getMulticastStreamIngest("roma_test22");               

                         streamIngest.playFromGroup(ingest);           

                     

                      var ncRtmp = new NetConnection();

                      ncRtmp.connect( application.urlRtmpFallBack );        

                      ncRtmp.onStatus = function(info)

                      {

                          trace ("ncRtmp=" + info.code);

                                                             

                          if (info.code == "NetConnection.Connect.Success")

                          {                                                       

                              var stremRtmp = new NetStream(ncRtmp);

                              stremRtmp.attach(streamIngest);   

                              stremRtmp.publish("1111");                       

                          }

                      };

                  }

              }    

          }