8 Replies Latest reply on Feb 15, 2011 2:11 AM by dodge1603

    flash player crashes in videoseek

    dodge1603 Level 1


      I have a very difficult problem, because I cannot find the point where my osmf player crashes of video seek.

      It is different from time to time. In some cases it crashes after the third seek, sometimes on the first.


      The main scenario is that the rtmp video starts playing and after a few quick seeks in the timeline which call the seekTime() function the whole browser crashes. Can it be caused by to many positions behind the dot, if the number is decimal?


      Here a small code preview:


      private function seekTime( value:Number ):void {
          if ( mediaPlayer && !!seeking ) {
              if ( mediaPlayer.playing ) {
              var mediaTime : TimeTrait = mediaPlayer.media ? mediaPlayer.media.getTrait( MediaTraitType.TIME ) as TimeTrait : null;
              var mediaSeek : SeekTrait = mediaPlayer.media ? mediaPlayer.media.getTrait( MediaTraitType.SEEK ) as SeekTrait : null;
              if ( mediaTime && mediaSeek ) {
                  if ( mediaSeek.canSeekTo( value ) ) {
                      mediaSeek.addEventListener( SeekEvent.SEEKING_CHANGE, onMediaSeekChange );
                      seeking = true;
                      mediaSeek.seek( value );
                  } else {
                      trace("seek failed");


      private function onMediaSeekChange( event:SeekEvent ):void {
          seeking = event.seeking;
          if ( !event.seeking ) {
              var seekable : SeekTrait = event.target as SeekTrait;
              seekable.removeEventListener( SeekEvent.SEEKING_CHANGE, onMediaSeekChange);
              if ( mediaPlayer ) {


      The videoplayer is created in this class:


      private function createVideoPlayer( startTime:Number=-1, endTime:Number=-1 ):void {
          this.removeEventListener( VIDEO_CONNECTION_CLOSED, onVideoConnectionClosedByPlayRequest ); // this eventlistener is only important for play request & timeout
          if ( playerConnection ) {
              playerConnection.removeEventListener( NetStatusEvent.NET_STATUS, onConnectionStatusChange );
              playerConnection = null;
          if ( !netLoader ) {
              var connection : NetConnectionFactory = new NetConnectionFactory( false );
              connection.addEventListener( NetConnectionFactoryEvent.CREATION_COMPLETE, onNetConnectionCreated, false, 0, true );
              connection.addEventListener( NetConnectionFactoryEvent.CREATION_ERROR, onNetConnectionError, false, 0, true );
              netLoader = new NetLoader( connection );
          var streamRes : StreamingURLResource;
          if ( startTime >= 0 && endTime >= 0 ) {
              streamRes = new StreamingURLResource( videoUrl, null, startTime, endTime );
          } else {
              streamRes = new StreamingURLResource( videoUrl);
          streamRes.urlIncludesFMSApplicationInstance = true;
          mediaElement = new LightweightVideoElement( streamRes, netLoader );


          var loadTrait : LoadTrait = mediaElement.getTrait( MediaTraitType.LOAD ) as LoadTrait;
          loadTrait.addEventListener( LoadEvent.LOAD_STATE_CHANGE, onMediaElementLoadChange );
          var layout : LayoutMetadata = new LayoutMetadata();
          layout.width                = uint( videoContentHolder.width );
          layout.height               = uint( videoContentHolder.height );
          layout.scaleMode            = ScaleMode.LETTERBOX;
          layout.horizontalAlign      = HorizontalAlign.CENTER;
          layout.verticalAlign        = VerticalAlign.MIDDLE;
          mediaElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layout);
          if ( !mediaPlayer ) { // mediaplayer existing -> set new clip
              mediaPlayer                           = new MediaPlayer();
              mediaPlayer.currentTimeUpdateInterval = 100;
              mediaPlayer.autoRewind                = false;
              mediaPlayer.autoPlay                  = true;


              if ( !mediaContainer ) {
                  mediaContainer = new MediaContainer();
                  mediaContainer.graphics.beginFill( 0x000000 );
                  mediaContainer.graphics.drawRect( 0, 0, videoContentHolder.width, videoContentHolder.height );
                  videoContentHolder.addChild( mediaContainer );
          // init eventlisteners only when needed
          mediaPlayer.addEventListener( MediaErrorEvent.MEDIA_ERROR, onError );
          mediaPlayer.addEventListener( MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE, onMediaplayerStateChange );
          mediaPlayer.addEventListener( TimeEvent.DURATION_CHANGE, onDurationChange );
          mediaPlayer.addEventListener( TimeEvent.CURRENT_TIME_CHANGE, onTimeChange );
          mediaPlayer.addEventListener( MediaPlayerCapabilityChangeEvent.CAN_BUFFER_CHANGE, onCanBufferChange );
          mediaPlayer.addEventListener( MediaPlayerCapabilityChangeEvent.CAN_SEEK_CHANGE, onCanSeekChange );
          mediaPlayer.addEventListener( TimeEvent.COMPLETE, onMediaplayerComplete );
          mediaPlayer.addEventListener( BufferEvent.BUFFERING_CHANGE, onBufferingChange );
          mediaPlayer.media = mediaElement;  
          mediaContainer.addMediaElement( mediaElement );


      I would be really glad if someone could help me.


      Thank you,


        • 1. Re: flash player crashes in videoseek
          Mykola3296 Level 2



          I bet it is the:



          It was fixed recently - you may want to update your OSMF to trunk revision 19249 or later.

          I've checked the fix in our project - it works fine now.

          • 2. Re: flash player crashes in videoseek
            dodge1603 Level 1

            Unfortunately the problem has not been fixed. I checked out the latest trunk, but the problem still remains.


            It's really easy to reproduce. One does not need to use a SerialElement or else, I use a LightweightVideoElement only. I'm starting the videoplayer and let it seek a few times. When I do a seek close to the current position in a high frequency the flash player crashes. In safari the problem comes much earlier than in firefox.


            My first idea was to setup a seek time tollerance to current position, but I was told than some users got the crash after the first seek. I have to check the first seek crashing with the new trunk, but the crash after a few fast seeks still exists.

            • 3. Re: flash player crashes in videoseek
              Andrian Cucu Adobe Employee

              Hi all,


              I reopened the issue: http://bugs.adobe.com/jira/browse/FM-1134


              Any additional details, especially about the 'business' impact, will help set the right priority for this issue management wise.


              Thank You,


              • 4. Re: flash player crashes in videoseek
                dodge1603 Level 1

                I went trough my code again and I think I missed an improtant change I made in the LightweightVideoElement class.


                In our project we are using the stepping feature and because of this I added this lines:

                case NetStreamCodes.NETSTREAM_PLAY_RESET:
                    if ( steppingEnabled ) {
                        try {
                            // If Flash Player is greater than 10.1, turn on smart seeking
                            // and set the size of the back buffer, in seconds.
                            stream.inBufferSeek   = true;
                            stream.backBufferTime = 10;
                            ApplicationDebug.getInstance().message = "ns.inBufferSeek: " + stream.inBufferSeek;
                        } catch(e:Error) {
                            ApplicationDebug.getInstance().message = e.message.toString();


                to the function onNetStatusEvent().


                I added a setting steppingEnabled to disable this feature and was not able to reproduce the crash again. In my opinion the bug is not really related to my problem. Additionally I added a doubleClick eventlistener to my timeline to prevent many clicks and checked, if the seek time is not equal the current playheadtime.


                Did I add the inBufferSeek at the wrong place? I need this feature.


                Thank you for your work and help.



                • 5. Re: flash player crashes in videoseek
                  Mykola3296 Level 2

                  As far as I remember when we tried to "localize" the bug for FM-1134 there seems to be a strange behaviour at NetStream itself.
                  Sometimes when a seek was performed the following behaviour took place. Here is an abstract from the discussion:

                  6) We assume the problem may lie in NetStream itself. The first time we came across the problem we used our serial element implementation inside a parallel. That implementation is used to simulate "playlist" (with prev/next ability) and does not proxy SeekTrait of underlying child. In that case the stack trace (above) was showing a loop between ParallelSeekTrait and NetStreamSeekTrait itself. During an "endless loop" the onNetStatus handler did not get NetStreamCodes.NETSTREAM_SEEK_NOTIFY message after netStream.seek in seekingChangeStart. Moreover previousTime == expectedTime clause in seekingChangeStart was always true - netStream.time (at line 104) always had the same (the one before seek attempt) time - so no ssek was performed inside the NetStream itself or, at least, it was not performed before the next "endless loop" attempt. So the easiest way to "fix" it is may be a use of delay or breaking a chain of loops with waiting of some NetStream status there.

                  So (may be) you are in the same kind of endless loop here but affected by the different sircumstances.
                  Does your browser crash instantly or hangs at first? If latter, could you pause a debugger and get the stack trace for the moment player hangs?


                  Our main concern was the behaviour of composite elements  - and the problem is fixed for us now. However we would like to implement a buffer seek sometimes (as you have described). And there was another problem described in original bug report post that is difficult to reproduce but it is the one  that appears occasionately:

                  During the experiments on this issue I've came across another strange video playback behavior.
                  When seeking a VideoElement (during the first "pass" or consequent) video display freezes as if paused but the sound continues to play.
                  So it somehow continues a playback without screen updates.
                  When the reel is over (considering the sound) video stops and rewinds to the first frame or advances to next item in composition.
                  May be that issue somehow goes to 10.1 cycle-saving feature (no screen updates when flash player is not visible)?
                  Considering the DisplayTrait of VideoElement is just a Video it may be an effect of Flash Player itself.
                  Not sure it should go to separate issue due to inconsistent reproduction and seeming affinity to described before.
                  However it appears on different computers (both PC and Macs) in our company.

                  It is somehow "connected" to seekeing to. So, as I've said above, may be all the problems described are the effects of Flash player malfunction itself?

                  1 person found this helpful
                  • 6. Re: flash player crashes in videoseek
                    dodge1603 Level 1

                    Thank you for your detailed answer.


                    I think you are right. The crashes seem to be away since I disabled the inBufferSearch attribute. So I guess it is an internal flash problem.

                    The browser crashes instantly so I'm not having any information. I was looking for some flash player stack traces at crash time, but was not able to find one. The crashes are to fast and individual for trying to pause.


                    I think I try the new flash player update. Maybe there are some improvements.

                    • 7. Re: flash player crashes in videoseek
                      Mykola3296 Level 2

                      Thank you to!


                      Could you please share your results here if you find a solution?

                      • 8. Re: flash player crashes in videoseek
                        dodge1603 Level 1

                        Ok, I found a half solution.

                        After setting a bigger buffertime(for example 30s), I need to have "inBufferSeek". So I enabled it again and found out, that mediaplayer.play() in the SeekEvent.SEEKING_CHANGE eventhandler can cause the instant browser crash. I still check if seeking has finished, but after removing the play() call the browser runns well again.


                        Now, I have another big problem. Now, I get the invalidArgs status from fms when seeking within the buffertime.