0 Replies Latest reply on Apr 7, 2008 9:05 AM by

    video scrub bar works, need to add one extra function

      Alrighty - so I have a video player. The player is set up to chain videos: open ad, video segment, ad, end segment (then stop).

      During the ads the scrub bar won't show so viewers must watch ad. The video segment the scrub bar shows. The actionscript for the scrubber is as follows:

      var videoInterval = setInterval(videoStatus,100);
      var amountLoaded:Number;
      var duration:Number;

      playFlvStream["onMetaData"] = function(obj) {
      duration = obj.duration;
      };


      // ***************************************************************************************** ***********************************************
      // Scrub Bar
      // ***************************************************************************************** ***********************************************

      function videoStatus() {
      vPlayerHMC.vidPlayer.amountLoaded = playFlvStream.bytesLoaded / playFlvStream.bytesTotal;
      loader.loadbar._width = amountLoaded * 104.8;
      loader.scrub._x = playFlvStream.time / duration * 104.8;
      }

      var scrubInterval;

      loader.scrub.onPress = function() {
      clearInterval(videoInterval);
      scrubInterval = setInterval(scrubit,10);
      this.startDrag(false,0,this._y,105,this._y);
      }

      loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
      clearInterval(scrubInterval);
      videoInterval = setInterval(videoStatus,100);
      this.stopDrag();
      }

      function scrubit() {
      playFlvStream.seek(Math.floor((loader.scrub._x / 105) * duration));
      }

      Now what I need to do is to have the scrub bar not allow a user to scrub to the end and trigger the next video. The current scrub bar allows a user to scrub to the end, which is 100% bytes total and then the AS fires off a control so that the next video loads. The video needs to be able to play fully, whether or not a user scrubs to the very end. In other words, allow them to move the scrub bar to the end...but if the video duration is not = 100% don't do anything. If it = 100% then the video segment has ended and get the next video to load and play.

      My thought was to write something either based on bytesTotal or possibly the videoInterval var.

      Any suggestions?