0 Replies Latest reply on May 31, 2007 11:53 AM by ramsantos

    VideoDisplay trying to reconnect after idleTimeout expires

    ramsantos
      Hi,

      I think there’s a bug on the VideoDisplay component. I am using it to play a flv file streaming from the Flash Media Server. When I pause the video and the idleTimeout time expires, if I try to resume playing it, the VideoDisplay state remains in ‘loading’ forever.

      I looked at the source code and saw that, when reconnecting to the Flash Media Server, the ‘play’ command was queued but never executed because, when autoBandWidthDetection is false (and there's no main.asc on the server), the method onReconnected() in NCManager and, consequently, ncReconnected() in VideoPlayer are never called.

      I made the changes below to the NCManager class and they worked fine for me, but I would like to know if anyone else has had that problem (and make sure this is an appropriate solution):

      public function reconnectOnStatus(event:NetStatusEvent):void
      {
      if ((event.info.code == "NetConnection.Connect.Failed")
      || (event.info.code == "NetConnection.Connect.Rejected"))
      {
      // Try the fallbackServer
      _netConnection = null;
      ncConnected = false;
      owner.ncReconnected();
      }

      //#RAS
      // Copied from connectOnStatus. When no bandwidth detection (i.e. when onBWDone was
      // not called); if reconnecting, the play command was queued but never executed
      // and the VideoDisplay state would stay in 'loading'.
      else if (event.info.code == "NetConnection.Connect.Success")
      {
      // Force call to onReconnected when main.asc is not present
      // which would call this function through onBWDone
      if (!owner.autoBandWidthDetection)
      onReconnected();
      }
      //#RAS
      }

      public function onReconnected():void
      {
      //#RAS
      // I think there was an error here??: I changed connectOnStatus to reconnectOnStatus
      _netConnection.removeEventListener(NetStatusEvent.NET_STATUS, reconnectOnStatus);
      //#RAS
      ncConnected = true;
      owner.ncReconnected();
      }

      Thanks