1 Reply Latest reply on Sep 21, 2010 10:20 AM by bringrags

    OSMF and FMS: SerialElement with 2 VideoElements, RTMP streaming

    fatmanchan2009

      Hello

       

      Ive been looking for a while and cannot find a answer to my problem, the problem is very simple.

       

      I have a SerialElement, stores 2 VideoElements, both videos resource are located on my Flash Media Server, so using RTMP as the URLResource.

       

      First Video is an Advert, the second is a Music Video. The Advert plays first, once that finishes the Music Video plays, sounds fairly simple.

       

      That works completely fine, both video plays in the right order and is stream correctly

       

      The problem is:

       

      Once the Advert is completed it leaves the Stream Connection on the Flash Media Server idle and the Music Video is played. When the Music Video is has finished playing the connection Stream to the Flash Media Server is cleared, but still leaving the previous Advert Stream idle

       

      after a few adverts and tracks has been played my Flash Media Server ends up with 10 Idle Connection streams, which causes the Flash Media Server to not respond to new connections to it.

       

      It is always the first element of the SerialElement that stays idle in the Flash Media Server.

       

      So that's the problem I'm having, and would appreciate it if anyone can help or solve this issue.

       

      Thank You

       

      Regards


      Stephen Chan

        • 1. Re: OSMF and FMS: SerialElement with 2 VideoElements, RTMP streaming
          bringrags Level 4

          While a SerialElement is being played, OSMF does not attempt to close the connection of any child, even if that child has already been played.  The reason for this is that the user might try to seek backwards to the previous child, and if the connection for that child has closed then it won't be able to play (i.e. we would need to attempt to reconnect).

           

          One approach you could try would be to remove children of the SerialElement after they've completed playback, so that you can close the connection without having to worry about the user seeking back to the child.  For example, you could listen for the SerialElement's currentChildChange event, and once the child has completed, call SerialElement.removeChild to remove the child.  To cause the element to close the connection, you need to call unload on the element's LoadTrait:


          var loadTrait:LoadTrait = element.getTrait(MediaTraitType.LOAD) as LoadTrait;

          loadTrait.unload();

           

          Note that the connection will not close if there are other streams using that same connection, because connection sharing is the default behavior within OSMF.  To disable connection sharing, you can pass in false to NetConnectionFactory's constructor.  (NetConnectionFactory is passed to NetLoader's constructor.)