16 Replies Latest reply on Jul 31, 2014 2:19 AM by Kirchgässner

    Video playback controls

    Kirchgässner Level 1

      So.

       

      I have imported an mp4-video (animation) in library an added it on to stage.

       

      With three buttons i want to click through the animation in 3 sequences.

       

      First of all there is a stop action before the video starts playing, so that you can click button 1 to start the video. Then button 2 for the next sequence etc.

       

      In the video playback-options, i have paused the video and added a StopAll-trigger before the label "sekvens2", and the I added a click-function to the button 2 with Play From* calling the label.

       

      Works fine when you click continously through the buttons from 1 to 3, but when I click button 2 from the beginning it wont play the video from that specific place.

       

      What to do? Has it somthing to do with my Playback options? Or?

       

      Thanks in advance

       

      video-controls.png

        • 1. Re: Video playback controls
          Sudeshnasarkar27 Adobe Employee

          For playfrom are you using :

          sym.$(<video element>)[0].currentTime = <time>;

          sym.$("CocaCola1972")[0].play();

          // to set the time from where you want the video to play and then triggering the play?

           

          Regards,

          Sudeshna

          1 person found this helpful
          • 2. Re: Video playback controls
            Kirchgässner Level 1

            No, i'm using 'play from' at the timeline calling the inserted label.

             

            Would it be better to use 'play video from'?

             

            And how would i look like if i want to play the video from five seconds? Like this?

             

            sym.$(<video element>)[0].currentTime = <time>;

            sym.$("Rais_Bionic_Final_12")[0].play(0:05);

            // to set the time from where you want the video to play and then triggering the play?

            • 3. Re: Video playback controls
              Kirchgässner Level 1

              Hi again

               

              I works-almost...

               

              Now i just need the video to stop at the beginnig at the timeline before clicking the buttons.

               

              How can i do that?

               

              Martin

              • 4. Re: Video playback controls
                Sudeshnasarkar27 Adobe Employee

                You can turn off the autoplay option(checkbox) for the video imported from the properties panel.

                 

                Regards,

                Sudeshna

                • 5. Re: Video playback controls
                  jbowden Adobe Employee

                  Kirchgässner wrote:

                  And how would i look like if i want to play the video from five seconds? Like this?

                   

                  sym.$("Rais_Bionic_Final_12")[0].play(0:05);

                  // to set the time from where you want the video to play and then triggering the play?

                   

                  Hi there,

                   

                  Perhaps you've already found this, but to play from 5 seconds, you'd use this:

                   

                  sym.$("Rais_Bionic_Final_12")[0].currentTime = 5;

                  sym.$("Rais_Bionic_Final_12")[0].play();


                  And yes as sudeshna mentioned, to stop the video from playing automatically, uncheck Autoplay in the Video properties (or remove any play actions on the video element in the timeline).


                  hth,

                  Joe

                  1 person found this helpful
                  • 6. Re: Video playback controls
                    Kirchgässner Level 1

                    Yes, but the video still automatically starts palying, because the playback-function i set to Play in the video-options.

                     

                    What to do?

                    • 7. Re: Video playback controls
                      jbowden Adobe Employee

                      Hello again,

                       

                      Uncheck Autoplay in the Video properties:

                       

                      autoplay.png

                       

                      hth,

                      Joe

                      1 person found this helpful
                      • 8. Re: Video playback controls
                        Kirchgässner Level 1

                        I did, but i didnt work. I think its because, i have set the playback options to Play, wich i need to, otherwise it wont play at all.

                         

                        Or what? Any idea?

                        • 9. Re: Video playback controls
                          jbowden Adobe Employee

                          Hello again,

                           

                          Your video element should not play unless it's set to Autoplay, OR you have added a play action to it in the timeline. Is there a play action on the video element in the timeline?

                           

                          Otherwise, can you please zip up your composition folder and post it where I can download it? You can share it from your Creative Cloud account, or Dropbox, etc.

                           

                          Thanks,

                          Joe

                          1 person found this helpful
                          • 10. Re: Video playback controls
                            Kirchgässner Level 1

                            I would like to. Where can i send it?

                            • 11. Re: Video playback controls
                              jbowden Adobe Employee

                              Hi Kirchgässner,

                               

                              You can either post a link here, or PM me with a link (open my profile, and then click the Send A Personal Message link on the right hand side).

                               

                              Thanks,

                              Joe

                              • 12. Re: Video playback controls
                                jbowden Adobe Employee

                                Hi Martin,


                                Sorry for the delay. So there are a few ways to approach this. Before I begin, let me explain how video (and audio) is treated within Animate:

                                 

                                Video/audio elements are similar to symbols in Animate: they must be explicitly addressed, and they behave as if they have their own "timeline" (duration, really). Unlike symbols, there's no actual timeline for the media element itself, but you can address them in similar ways.

                                 

                                So in your composition, your buttons use code such as sym.play("sekvens1"); - this code is essentially telling Animate's Stage to play from the label "sekvens1", and it will do so. But you're not telling the video element named "Rais_Bionic_Final_12" to play, or where in the video to play from - and so it does not also play.


                                The simplest way to make this work the way you would like is to add a Play From action to the video element at each of the label times, and enter the time you'd like the video element to play from. If you want to do more coding, you can also do it that way.


                                I hope this explains it, but if anything is unclear, feel free to ask.


                                Regards,

                                Joe

                                1 person found this helpful
                                • 13. Re: Video playback controls
                                  Kirchgässner Level 1

                                  Hi Joe

                                   

                                  I will try to do that, and then i'll return later

                                   

                                  You're very helpfull.

                                   

                                  Thanks a lot

                                   

                                  martin

                                  • 14. Re: Video playback controls
                                    Kirchgässner Level 1

                                    timecontrol2.jpg

                                    Hi Joe

                                     

                                    I added a trigger at the time of the labels, and I get this dialog-box.

                                     

                                    I try to set the excact time a 5 seconds. But where? Is it the currentTime?

                                     

                                    Martin

                                    • 15. Re: Video playback controls
                                      jbowden Adobe Employee

                                      Hi Martin,

                                       

                                      Yes, that's correct - set currentTime = 5, and follow it with a play command and it will play starting at 5 seconds into the video element.

                                       

                                      Don't forget you can instead use a Play From playback action without adding any Javascript, as shown below:

                                       

                                      Screen Shot 2014-07-28 at 11.32.10 AM.png

                                      hth,

                                      Joe

                                      1 person found this helpful
                                      • 16. Re: Video playback controls
                                        Kirchgässner Level 1

                                        Ok, that works!

                                         

                                        But i need one more thing. When i click button 1 i want the sekvens1 to stop excactly where sekvens 2 starts. Is that possible?

                                         

                                        Martin