1 Reply Latest reply on Jan 26, 2012 2:19 PM by ZachUK

    RTMP playback hangs after seek; MediaPlayerSprite and DynamicStreamingResource from FMS


      OSMF 1.5 was utilized to build this media presenter application: http://www.cecentral.com/activity/3593/?t=presenter


      If you scrub the marker through the timeline, notice that when the playhead is dropped and the stream updates its position, there is a considerable lag before the video resumes playback.


      The streams used are hosted from Amazon CloudFront (Flash Media Server).


      I've come up with several test cases where the scrubbing does NOT result in a delay, and playback resumes immediately:

      • When I load the same streams into Strobe Media Player, there is no delay after scrubbing.
      • When the application is loaded into a browser on an Android with Flash Player 11, there is no delay after scrubbing.
      • When the same application linked above loads streams from a Wowza media server, rather than FMS, there is no delay after scrubbing.


      So the delay in scrubbing is only occuring on workstations with Windows or OS X and Flash Player 11, and when streaming from Flash Media Server.


      In this application I am creating OSMF MediaPlayerSprite, with a DynamicStreamingResource for the streams. Since SMP is most responsive to the streams being utilized by the application linked above, I pored over the SMP code and see that SMP utilizes a PlaybackOptimizationManager class, which seems to handle NetStreams and buffering in a separate way to MediaPlayerSprite (which is much more straightforward, and well-documented).


      Does anyone have any suggestions regarding the hang / delay on seek, or commentary about whether implementing the PlaybackOptimizationManager might fix this issue?



        • 1. Re: RTMP playback hangs after seek; MediaPlayerSprite and DynamicStreamingResource from FMS
          ZachUK Level 1

          Here you can see one of our streams coming from the same Flash Media Server instance as the sluggish one from above: http://www.cecentral.com/tmp/osmf.html


          Here is how I instantiate MediaPlayerSprite and VideoElement:


                         // Setup Media Player Component 
                         mps = new MediaPlayerSprite();
                         mps.mediaPlayer.volume = SettingsUtil.getInstance().globalVolume;
                         mps.mediaPlayer.bufferTime = 3;
                         mps.mediaPlayer.currentTimeUpdateInterval = 100;
                         var webcastVO = WebcastManager.getInstance().webcast;
                         var dsr:DynamicStreamingResource = new DynamicStreamingResource(webcastVO.network.rtmpCDN);
                         for (var i:int = 0; i < videoVO.sources.length; i++) {
                              var theSource:VideoSourceVO = videoVO.sources[i];
                              dsr.streamItems.push(new DynamicStreamingItem(theSource.file, theSource.bitrate, theSource.width, theSource.height));
                         dsr.initialIndex = videoVO.preferredIndex;
                         var videoElement:VideoElement = new VideoElement();
                         videoElement.resource = dsr;
                         mps.media = videoElement;
          // .... //


                         // Media Player Signals
                         new NativeSignal( mps.mediaPlayer
                                         , MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE
                                             , MediaPlayerStateChangeEvent).add(onPlayStateChange);


          When a video is streaming, and the playhead is dropped in another position, the lag occurs AFTER receiving state change of "playing" from mps.mediaPlayer:


          VideoPlayer::onPlayStateChange() buffering // video added to stage
          VideoPlayer::onPlayStateChange() playing // video playing
          VideoPlayer::onPlayStateChange() buffering // playhead moved / seek
          VideoPlayer::onPlayStateChange() playing // this occurs, and loading animation is removed from VideoElement
          // 1 - 5 seconds pass, then video resumes playback