1 Reply Latest reply on Jul 9, 2009 11:24 AM by deftones_sv

    Get the flv total time in AS2

    deftones_sv

      Hi.

       

      I am loading a flv video in AS2:

       

      var conexion:NetConnection = new NetConnection();
      conexion.connect(null);
      var stream:NetStream = new NetStream(conexion);
      mi_video.attachVideo(stream);
      stream.play("motto.flv");
      this.onEnterFrame = function() {
          if (stream.time>0) {
              var integer:String = String((stream.time*.0166) >> 0);
              var decimal:String = String((stream.time%60) >> 0);
              timer_txt.text = ((integer.length<2) ? "0"+integer : integer)+":"+((decimal.length<2) ? "0"+decimal : decimal)
          } else {
              timer_txt.text = String("00:00");
          }
      };

       

      It wokrs very good, In this line, I get de current time of the flv:

       

      timer_txt.text = ((integer.length<2) ? "0"+integer : integer)+":"+((decimal.length<2) ? "0"+decimal : decimal)

       

      An I need to display the total time too..

       

      By the way, I am not using the any flv component, I need to play the video in a custom player....

       

      Thanks

        • 1. Re: Get the flv total time in AS2
          deftones_sv Level 1

          I answer myself:

           

          stream.onMetaData = function(info:Object) {
                  var totalInteger:String = String((info.duration*.0166) >> 0);
                  var totalDecimal:String = String((info.duration%60) >> 0);
                  total = ((totalInteger.length<2) ? "0"+totalInteger : totalInteger)+":"+((totalDecimal.length<2) ? "0"+totalDecimal : totalDecimal);
              };