2 Replies Latest reply on Aug 10, 2010 8:01 PM by davegamez

    multicast streaming - netstream error

    tfcenturion

      Hi everyone,

       

      Iv been having issues with one of the videos demos from adobe site on this multicast streaming, this is the video http://tv.adobe.com/watch/adc-presents/multicast-streaming-in-flash-player-101

       

      I downloaded the code that goes with the video but i keep getting an error on the netstream,

      Error: Error #2154: The NetStream Object is invalid.  This may be due to  a failed NetConnection.
        at flash.net::NetStream/invoke()
        at  flash.net::NetStream/attachCamera()
        at  Broadcaster/setupStream()[D:\flex4_workspaces\Stratus_Demo\src\Broadcaster.mxml:67] 
        at  Broadcaster/netStatus()[D:\flex4_workspaces\Stratus_Demo\src\Broadcaster.mxml:50]

       

      Now iv tracked it down to when the camera is added but see no reason as to why it wont attach.

       

      any help would be great.

        • 1. Re: multicast streaming - netstream error
          tfcenturion Level 1

          Hi all,

           

          I was able to sus where the issue had come from.

           

          Because the Net Stream was not fully init, it was erroring when the camera was being added.

           

          I placed a check in the netstatus function for the NetStream.Connect.Success and ran a function when it was fired eg

           

          private function netStatus(event:NetStatusEvent):void
                      {
                          writeText( "Command - " + event.info.code );
                         
                          switch(event.info.code){
                              case "NetConnection.Connect.Success":
                                  setupStream();
                                 
                                  break;
                             
                              case "NetStream.Connect.Success":
                                  setupStream2();
                                 
                                  break;

                             
                          }
                         
                      }

           

          private function setupStream2():void
                      {
                          var cam:Camera = Camera.getCamera();
                         
                          nsVideo.attachCamera(cam);
                          nsVideo.publish("multicast");
                         
                          video.attachCamera(cam);
                      }

           

          i know it nots the best way and if some one finds a better way please post it here.

           

          Thank you..