1 Reply Latest reply: Jun 11, 2014 12:53 PM by radu_k RSS

    Strobe seek on start

    radu_k Community Member

      I'm implementing a "resume play" feature where the start seek location gets passed in to my SMP player. I'm having a hard time figuring out what's the best place to do the one-time initial seek.

       

      My best initial guess was to add a media state listener but that doesn't seem to be working, I tried hooking up to the READY, BUFFERING or PLAY event.

       

      Any thoughts?

        • 1. Re: Strobe seek on start
          radu_k Community Member

          I have this, and it does seek to the right place, but then the seek bar gets all messed up (it still shows as being at the beginning), but it plays content form the seeked time. Trying to use the seekbar after that gets erratic results...

                   public function seek(time:Number):void{

                      player.addEventListener

                      ( MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE

                              , seekOnce

                      );

           

           

                      function seekOnce(event:MediaPlayerStateChangeEvent):void

                      {

                          if ( event.state == MediaPlayerState.READY )

                          {

                              // Make sure this event is processed only once:

                              player.removeEventListener(event.type, arguments.callee);

                              player.seek(time);

                          }

                      }

                  }