3 Replies Latest reply on Dec 17, 2009 2:14 PM by formatlos

    Video - show first frame without autoStart


      hey guys,

      how can I show the first frame of a video, if autoStart is disabled?



        • 1. Re: Video - show first frame without autoStart
          rfrishbe Level 3

          There's no easy way to do this, but essentially what you want to do is 3 methods: play(), pause(), seek(0).


          The exact pattern should be something like:


          step 0:

          set the source

          set autoPlay = false

          // add listener for step1


          step 1 (in mediaPlayerStateChangeHandler in the READY state):

          videoPlayer.muted = true;
          videoPlayer.view.visible = false;

          // call play(), here, then wait to call pause() and seek(0) in the
          // dimensionChangeHandler

          // add listener for step 2



          step 2 (in dimensionChangeHandler):

          // the seek(0) is asynchronous so let's add an event listener to see when it's finsished:
          videoPlayer.addEventListener(SeekEvent.SEEK_END, videoPlayer_seekEndHandler);

          // called play(), now call pause() and seek(0);

          // add listener for step 3



          step 3 (in seekEndHandler):

          videoPlayer.muted = beforeLoadMuted;
          videoPlayer.view.visible = true;


          Hope that helps,


          1 person found this helpful
          • 2. Re: Video - show first frame without autoStart
            formatlos Level 1

            thanks for your reply ... that's more or less the way I've been trying to implement it.

            are there any plans for a more straightforward implementation in the framework? I would guess that this is a very common feature


            cheers Martin

            • 3. Re: Video - show first frame without autoStart
              rfrishbe Level 3

              I don't work on the OSMF team, so I can't answer for them, but this approach to load up the first frame is not really recommended practice, so I wouldn't hold my breath waiting for them to implement this feature for you.  That's because it downloads all this content automatically and makes tracking video views much harder.


              A better approach to do this would be to load up a thumbnail or an Image at first.  This will give the video its size and also display the frame you want before the user actually starts playing the video.