2 Replies Latest reply on Jan 27, 2011 9:53 PM by Mykola3296

    Error interception / ProxyElement feature?

    Mykola3296 Level 2

      Hello!

       

      Is there any clean way to intercept MediaError and prevent it from going to MediaPlayer?

      For example I have a video element that should reconnect automatically if connection is lost (similar to stream reconnect but another use case). In that case I handle reconnect in proxy element without "bubbling" event up the composition chain to MediaPlayer.

       

      The most obvious way for me is using a ProxyElement with custom traits but there is a minor inconvenience there - the event handler that handles proxied element error is marked as private. So I have to subscribe an event with higher priority and stop event propagation that seems a little "dirty".

       

      Is there any cleaner way to block an error from elements "above"?

       

      Or may be you (OSMF team) could make some template method in future release? Something like:

      private function onMediaError(event:MediaErrorEvent):void
      {
           if (false == isErrorHandled(event)) {
                dispatchEvent(event.clone());
           }
      }
      
      /**
       * Processes a proxied element error.
       * @return True if error was processed and no "bubbling" needed.
       */
      protected function isErrorHandled(event:MediaErrorEvent):Boolean {
           return false;
      }
      

       

      What do you think?

       

      Best regards!