6 Replies Latest reply on Aug 17, 2015 5:24 PM by seanp@je

    Having mp4 auto pause on frame, and continue to next section on next btn click

    seanp@je

      I have a animation in AE of 3d layers rotating around and stoping when lined up with a static object behind it, I want the video to stop when an object is lined up, and then I want the video to continue to play and stop at the next item that is lined up, and I want to use buttons to control when to override the stop and keep playing until the next stop command.

      Basically, I want the video to play in the time line, and at frame 30 to stop, and once you click next, it will begin to play until it hits another stop command at another frame (say frame 60). I'm having issues where the movie will just not play, i've tried to convert the video to a symbol so that other symbols can be told to play and stop and play it specifically, but the results are not what I want. Usually the video will just play, or it will be stopped at the beginning.

       

      I'm familiar with flash, and this would be a slam dunk in that, but I need to move away from flash and would like to use edge for this.

        • 1. Re: Having mp4 auto pause on frame, and continue to next section on next btn click
          jhtmk Level 3

          This sounds pretty straight forward, when you scrub though the timeline on the stage it should also scrub through the video playback (or any symbol’s timeline)

           

           

          The elements nested timeline is indicated by the chevron arrows on the stage’s timeline.


           

          So if you scrub through to the position in the video that you want via the stage, when you reach that add a trigger on the stage and add the video playback code snippets.


           

          example:


           

          //pauses the video

           

          sym.$(“videoName")[0].pause();


           

          And if you have a button on your stage that says “next” where you want the video to play to the next point, right click the element, open actions for that element choose click and follow the code snippets, it should look something like this:


           

          sym.$(“VideoName")[0].play();


           

          You can also use the "play from” and set the exact time in a video where you want it to start playing from and then exact times where you want it to stop, to break the video into sections and then you can add these events to buttons so the user can control it.

          • 2. Re: Having mp4 auto pause on frame, and continue to next section on next btn click
            seanp@je Level 1

            I posted this then discovered that there are specific controls for video, over just using generic controls for a symbol.

             

            Ok, so yes I should be able to drive this with stops on the timeline, and a click event on a button.

             

            Here's the thing, I loaded a video into my timeline, and I can't preview it unless it's autoplay is selected, so with it on autoplay I go through the timeline and put stops where I want them to stop ( sym.$("HALO_animation_2")[0].pause(); ) and the button to continue to play's code is on click ( sym.$("HALO_animation_2")[0].play(); ) then I turn off autoplay as the first frame should be paused.

             

            The results I get with this are spotty, what happens is the video will pause early or late, and once I press the button it will play the video, but it then may pause almost immediately. Once it has gotten to the last frame of my video, it will repeat and completely ignore any stops in the timeline.

             

            It feels as if the timeline for the project and the timeline for the video are not matching up, causing the video to break.

            • 3. Re: Having mp4 auto pause on frame, and continue to next section on next btn click
              seanp@je Level 1

              what does the [0] represent in the code, when the code is sym.$("HALO_animation_2")[0].play(); is that how long it pauses, what frame it pauses, or just a place for a lonely zero?

              • 4. Re: Having mp4 auto pause on frame, and continue to next section on next btn click
                pittsburgh_joe Level 3

                [0] is just javascript lingo telling it to grab the first child of HALO_animation_2  ..nothing to do with pause/play times

                 

                to do pause times, you will have to do advanced coding like this

                 

                sym.$("HALO_animation_2")[0].addEventListener("timeupdate", function() { // function updates if video plays //tells video when to pause

                if(sym.$("HALO_animation_2")[0].currentTime>=2.0) { //after two seconds of playing ..pause the video

                      sym.$("HALO_animation_2")[0].pause();

                  }

                });

                • 5. Re: Having mp4 auto pause on frame, and continue to next section on next btn click
                  seanp@je Level 1

                  so where do I put the listener, in the main timeline?

                  I don't really want it to play for X seconds, I want it to pause the video at certain frames _every_time_ it loops.

                  I've made a button that will pause/unpause the playback, so I want it to automatically hit .6258 on the timeline and just pause.

                  I've tried using the play/stop buttons on the timeline, can't get them to interact with anything they just sit there on pause and never move again.

                  I'm not super advanced, but I'm not a beginner when it comes to code. I just don't understand how the language is interacting with the timeline.

                  • 6. Re: Having mp4 auto pause on frame, and continue to next section on next btn click
                    seanp@je Level 1

                    also I've tried going to the frames, and putting pause commands at the actions part of the timeline, but again its like they're just ignored everytime they're hit.