2 Replies Latest reply on Jul 5, 2016 4:32 PM by rulogrunge

    Play/pause function

    rulogrunge Level 1

      Hello there

       

      I'm quite new in Edge Animate and I'm working on a project that involves video and some pictures.

       

      The timeline runs synchronizing the pictures and the video, it moves to specific trigger keyframes, and when you hit the next or previous buttons, it changes the picture shown and the video time.

       

      I've figured out everything except a function to the play/pause button. What I need to do is that this button toggles play/pause in the video and in the timeline at the same time, is this possible?

       

      The code I have for the button that controls this:

       

      if (sym.getSymbol("main_video").$("VIDEO")[0].paused) {

        sym.getSymbol("main_video").$("VIDEO")[0].play();

      } else {

        sym.getSymbol("main_video").$("VIDEO")[0].pause();

      }

       

      This works fine with the video, but it doesn't affect the timeline (where the pictures are), the pictures keep running on the timeline, even if the video is in pause.

       

      I've tried to stop the timeline adding this to the play/pause button

       

      if (sym.getSymbol("Stage").$("Stage")[0].paused) {

        sym.getSymbol("Stage").$("Stage")[0].play();

      } else {

        sym.getSymbol("Stage").$("Stage")[0].pause();

      }

       

      This doesn't pause/play the timeline.

       

      Help will be very appreciated!

        • 1. Re: Play/pause function
          ddhayles Level 3

          To stop or play the timeline simply type:

           

          this.play(); 

          or

          this.stop();

           

          If you want to stop or play a timeline in a symbol use:

           

          sym.getSymbol("timelineName").play(); // Play timeline

          sym.getSymbol("timelineName").stop(); // Stop timeline

          • 2. Re: Play/pause function
            rulogrunge Level 1

            Hi ddhayles

             

            Thank you for your reply. The thing is, if a put a stop on the timeline and then a play, it restarts the timeline, what I need is a pause function, for example:

             

            Video and timeline are running... I press the play/pause button... the video pauses at second 40 on the video (the function works with the code I posted in my original question) but the timeline keeps running, so, if I press the button again, the video will start on second 40, but the timeline will be maybe on keyframe 200 (depending on how long I press the button again)

             

            The thing is...

            I need a function to toggle play/pause the video and the timeline simultaneously, so if I hit the button at second 40 on the video and keyframe 40 on the timeline, both are paused, and when I hit the button again both had to start again on the same place they stopped.

             

            I hope I've been clear enough, I've tried for several days finding the answer on this issue and nothing is working