3 Replies Latest reply on Nov 20, 2009 7:28 AM by Rothrock

    Problem : Elapsed Time For SWF file Player

    gaurawerma Level 1

      I am making a player for SWF files.

      I have a play-progress bar in the player that I can drag to start playing the swf movie at any point.

       

      And now have no clues how to calculate the elapsed time when the progress bar is dragged.

      If the progress bar is not dragged then I can use the getTimer() procedure to calculate the elapsed time even if the movie is paused / resumed.

      But what to do when the progress bar is dragged ???

       

      I know, it's easy to do this when FLVs are used.

       

      NOTE: I cannot edit the external SWF files that has to be played. They are simple movie clips with no controls.

        • 1. Re: Problem : Elapsed Time For SWF file Player
          kglad Adobe Community Professional & MVP

          a play-progress bar should be tied to the frame numbers of a movieclip, that a time.

          • 2. Re: Problem : Elapsed Time For SWF file Player
            Rothrock Level 5

            That is because getTimer() measures the actual elapsed time since a given instance of a player was started. It doesn't measure the time on a given frame.

             

            If you run the same test over an over you will see that the time on a given frame fluctuates by a little bit. Depending upon what else the processor is doing and....for all I know the phase of the moon. FLVs are different and they actually have time information embedded into their structure.

             

            However if you know how many frames your external movie has and you know its frame rate you can "estimate" the duration.

             

            duration = total frames * fps

            current time = current frame * duration

             

            However it will just be an estimate. And on long clips it could differ significantly from a getTimer().

             

            So I would recommend not using getTimer at all and always just faking it with the esitmate.

            • 3. Re: Problem : Elapsed Time For SWF file Player
              Rothrock Level 5

              Totally messed up the math. (forgot my unit analysis!)

               

              duration = total frames / fps

               

              current time = duration * current frame / total frames