5 Replies Latest reply on Mar 9, 2010 10:15 PM by Amitpalsd

    Make Video Pause When Clicked?

    seansks

      Hi, I have a flash video that is set to autoplay when the page loads. We've just implemented thickbox/lightbox system on it now so when you click on the video it enlarges into that new frame. Problem is, when that's done the video/audio is still playing while the video in the thichbox is playing too. This leading to ineffective listening. Does anyone know a code that would trigger the video to pause when clicked anywhere on the video screen?

        • 1. Re: Make Video Pause When Clicked?
          Bravenson

          I understand your problem better remove the light box option and play it because its all some plug-in problems...

          • 2. Re: Make Video Pause When Clicked?
            Amitpalsd

            You can pause the video, could you please let me know how you embed and play video in flash. FLVPlay back or what? only then I can let you know how can you pause video.

             

            regards/Amitpal

            • 3. Re: Make Video Pause When Clicked?
              seansks Level 1

              Amitpal - Thanks for offering to help!

               

              Right now the videos being tested at this link - http://edlevinjewelry.com/indexTEST.html

              I don't currently have the video linked up to lightbox, just a link above the video to expand.

               

              With FLVPlayback,this is my current code (it's currently coded and set up so the video autoplay starts at 52 seconds)...

               

               

              import fl.video.MetadataEvent;
              import fl.video.VideoProgressEvent;

               

              import fl.video.*;

               

              my_FLVPlybk.addEventListener(VideoEvent.COMPLETE, rewind);
              function rewind(eventObject:VideoEvent):void {
                  my_FLVPlybk.seek(52);
                  my_FLVPlybk.play();

               

              }

               

              var fp:FLVPlayback = my_FLVPlybk;
              fp.addEventListener(VideoProgressEvent.PROGRESS, videoProgressHandler, false, 0, true);
              fp.addEventListener(MetadataEvent.METADATA_RECEIVED, metaDataHandler, false, 0, true);
              fp.autoPlay = false;

               

              var startSeekTime:Number = 52;
              var videoDuration:Number;
              var videoSeeked:Boolean = false;

               

              function metaDataHandler(event:MetadataEvent):void {
                   if(event.info.duration != null){
                        videoDuration =event.info.duration;
                   } 
              }

               

              function videoProgressHandler(event:VideoProgressEvent):void {
                   var fp:FLVPlayback = event.currentTarget as FLVPlayback;
                   var bytesLoaded:Number = event.bytesLoaded;
                   var bytesTotal:Number = event.bytesTotal;
                   if( !isNaN(videoDuration)){

               

                        if( (bytesLoaded/bytesTotal) >= ( (startSeekTime+4)/videoDuration) && !videoSeeked ){

               

                             videoSeeked = true;
                             fp.seek(startSeekTime);

               

              fp.play();
                        }
                   }
              }

              • 4. Re: Make Video Pause When Clicked?
                seansks Level 1

                Any input would be beyond appreciated. Still having no luck with this.

                • 5. Re: Make Video Pause When Clicked?
                  Amitpalsd Level 1

                  You can add one more layer above you FLVPlayback and create a transparent button/clip. And then add click listener on that.

                   

                  suppose transparent clip is named as "btnClip" and player is named "fp"

                   

                  btnClip.addEventListener(MouseEvent.CLICK, onBtnClick)

                   

                  function onBtnClick(_event:MouseEvent):void {

                       fp.pause();

                  }

                   

                  I believe this will help you out.