2 Replies Latest reply on Feb 9, 2010 11:51 PM by jcastelain

    MediaPlayer and seeking

    jcastelain Level 1

      Hi all,

       

      I have my Flex application that contains a MediaPlayerWrapper instance on  the stage, that displays a ParallelElement containing two VideoElements (wow that was long), is there a method or a property in the MediaPlayer class that allows me to know to where I can seek?

       

      I saw the MediaPlayer.canSeekTo, MediaPlayer.canSeek and MediaPlayer.seek methods but what I'd like to do is something like this :

       

      1 - create my media elements and assign that to the MediaPlayer's media property

       

      2- untill the videos have been completely loaded, call a Method that would return the "time" to where I can seek for example (in pseudo code)

          function getSeekTime(){
              return "the time at which my media player can seekTo;
          }

       

      I don't know if this is possible  at all, but it would be really useful

       

      Thanks for your help ,

      Julien

        • 1. Re: MediaPlayer and seeking
          bringrags Level 4

          The only case where you can't seek to the end is progressive playback (I assume that's what you're using), in which case your maximum seek point is a function of how much data you've downloaded, which MediaPlayer exposes via the bytesLoaded property.  So you could probably do some simple math to find that point:

           

          function getMaxSeekTime():Number

          {

              var percentLoaded:Number = mediaPlayer.bytesLoaded / mediaPlayer.bytesTotal;

              return mediaPlayer.duration * percentLoaded;

          }

          • 2. Re: MediaPlayer and seeking
            jcastelain Level 1

            Hi Bryan,


            Once again, thanks for the explanation, that's exactly what I wanted to do

             

            Julien