4 Replies Latest reply on Jan 4, 2010 8:20 PM by ab1301

    Webcam and NetStream NetStream.Play.StreamNotFound

    ab1301 Level 1

      I'm trying to attach a webcam to a netstream, but I get NetStream.Play.StreamNotFound every time I try to play the stream.

       

      When I attach the camera to the videoplayer instead of attaching the netstream, it works fine (see the commented out line), so i know its not a problem with the camera.  I want to get the netstream working, though, so I can eventually record the video.  So anyone have any ideas?

       

                  private function videoPlayer_creationComplete():void {
                      camera = Camera.getCamera();
                      connection = new NetConnection();
                      connection.addEventListener(NetStatusEvent.NET_STATUS, connectionhandler);
                      connection.connect(null);
                     
                  }
                 
                  private function connectionhandler(e:NetStatusEvent):void{
                      if ( e.info.code == "NetConnection.Connect.Success") {
                          vidstream  = new NetStream(connection);
                          vidstream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                          if (camera) {
                              camera.setMode(640, 480, 30);
                              vidstream.attachCamera(camera);
                              videoPlayer.videoElement.videoObject.attachNetStream(vidstream);
                              //    videoPlayer.videoElement.videoObject.attachCamera(camera);
                              vidstream.publish("camerastream");
                              vidstream.play("camerastream");
                          } else {
                              Alert.show("No camera.");
                          }
                      }
                  }