3 Replies Latest reply on Nov 17, 2009 2:19 PM by bringrags

    READY Event

    NickAlanHippe

      1) Is there an event that is dispatched when the player is ready to make a connection to an FMS server? 


      2) what is the event that is displatched when that connection was either successful or failed?

        • 1. Re: READY Event
          bringrags Level 4

          There are two levels of events here.  In most cases, the MediaPlayerStateChangeEvent on MediaPlayer will be sufficient:  just check for the READY state.  (And if the connection fails, you'll end up in the PLAYBACK_ERROR state.)  Buf if you want more fine-grained events, you can listen to the events dispatched by NetConnectionFactory (which works with NetLoader).  Typically you'll only need to work with NetConnectionFactory if you want to override the default connection logic (which is fairly rare).

          • 2. Re: READY Event
            NickAlanHippe Level 1

            Thanks, I will look into those events. I have one more question that is related. If you use a video object (not osmf) you typically attempt a connection and wait for a success response before trying to play. Is the same approach possible using osmf?

            • 3. Re: READY Event
              bringrags Level 4

              Yes, this is what OSMF (and specifically NetLoader) does under the hood.  NetLoader will try to connect using HTTP or RTMP.  For the former, it will try to reuse an existing (open) NetConnection, or perform port-protocol negotiation to create a new one.  We're aiming to isolate this complexity so that developers don't need to recreate it every time they build a new player.

               

              When the connection attempt finally succeeds (or fails), it triggers an event on the ILoadable that it's loading.  This event eventually propagates its way up to the MediaPlayer, and is translated into the MediaPlayerStateChangeEvent that I mentioned.