4 Replies Latest reply on Feb 21, 2012 7:06 AM by MicMic1234

    Syncing Parallel Elements

    ionflow Level 1

      What's the best way to ensure parallel elements start playing at the same time? I assume I would turn autoplay off and then listen for each playable element to fire ready states?

        • 2. Re: Syncing Parallel Elements
          ionflow Level 1

          Looks like this example works great for bufferable elements, but if any of the elements being played in parallel are not bufferable (DurationElements) then the implementation fails.

           

          Update: ...fails in the sense that the duration element is not paused while the other elements are buffering.

          • 3. Re: Syncing Parallel Elements
            ionflow Level 1

            I discovered, through bandwidth restriction, that this SynchronizedParallelElement example doesn't actually work when trying to play two bufferable videos in sync. I modified the updatePlayState function as follows to get it to work as expected. This change also fixes the issue with a duration element not pausing while other elements are buffering as mentioned above.

             

            private function updatePlayState(..._):void

            {

                 if(bufferable)

                 {

                      trace("buffering:"+bufferable.buffering);

                      trace("bufferTime:"+bufferable.bufferTime);

                      trace("bufferLength:"+bufferable.bufferLength);

             

                      if(playable)

                      {

                           trace("playstate:"+playable.playState);

             

                           if(!paused

                              && bufferable.buffering

                              && playable.canPause

                              && bufferable.bufferLength < bufferable.bufferTime)

                           {

                                playable.pause();

                                paused = true;

                           }

                           else if(paused

                                   && (!bufferable.buffering || bufferable.bufferLength >= bufferable.bufferTime))

                           {

                                playable.play();

                                paused = false;

                           }

                      }

                 }

            }

            • 4. Re: Syncing Parallel Elements
              MicMic1234

              Hi, were you able to make the elements start playing at the same time? I can't get it to work, even when using SynchronizedParallelElement with your fix.

              Do you have any suggestions?

               

              Thanks!