5 Replies Latest reply on May 31, 2009 4:45 PM by kglad

    Multiple embedded players. Playing one pauses others?

    archinla

      I have multiple (7) embedded QuickTime mp3's in a DW CS4 page. Each has their own, standard audio controller - play/pause etc.

       

      Instead of using Quicktime would it be possible with a flash player to have these players pause/stop whichever one is playing if PLAY is hit on another?

      There are flash audio player buttons that pause other clones  - but I've only found ones that do that ONLY if they're within the SAME flash movie, NOT if elsewhere on the page.

       

      The page in question is a crucial product sales page. Products have their own section on the page and each product has its own embedded audio clip. A playlist would not work.

      In other words I'd just like multiple audio players on my page that are "aware" of each other's status and permit only one to be played at a time.


      Many thanks for any advice!

        • 1. Re: Multiple embedded players. Playing one pauses others?
          kglad Adobe Community Professional & MVP

          yes, you can use the localconnection class to allow multiple swfs embedded in an html page to communicate with each other.

          • 2. Re: Multiple embedded players. Playing one pauses others?
            archinla Level 1

            Thanks kglad. Any hints on how to do that? I'm just a novice. What would be nice is to find another page somewhere that does this. I'm surprised it's not a more commonly requested feature of embeded audio or video files.

            • 3. Re: Multiple embedded players. Playing one pauses others?
              kglad Adobe Community Professional & MVP

              here's code that i usedwith 5 embedded mp3 players in one html page.  i used the same player.swf for each of the 5.  they all contained the following code:

               


              var tl:MovieClip = this;
              var snd:Sound = new Sound();
              var preloadI:Number;
              // ************* flashvars **********************
              flashVarA = fvar.split(",");  // i used flashvars so each player.swf knew which one it was
              playerNum = flashVarA[0];
              playerTotal = flashVarA[1];
              mp3URL = flashVarA[2];
              // ************* flashvars **********************
              // ************* local connections **************
              for (var i = 1; i<=playerTotal; i++) {  // this sets up all the localconnections
                  if (i != playerNum) {
                      tl["sendLV"+i] = new LocalConnection();
                  } else {
                      // i = flashNum
                      tl["receiveLV"+playerNum] = new LocalConnection();
                      tl["receiveLV"+playerNum].connect("lc"+playerNum);
                      tl["receiveLV"+playerNum].lcF = function(s:String){
                          // another swf is downloading or playing an mp3
                          tl.startSound = false;
                          snd.stop();
                          playBtn.gotoAndStop(1);
                          stopBtn.gotoAndStop(1);

               

                          tf._visible = false;
                          playBtn._visible = true;
                          stopBtn._visible = true;
                          stopBtn.enabled = false;
                      }
                  }
              }

               

              function sendLocalConnectionsF() {  // this function calls all the other localconnection functions.
                  for (var i = 1; i<=playerTotal; i++) {
                      if (i != playerNum) {
                          tl["sendLV"+i].send("lc"+i,"lcF");
                      }
                  }
              };

              • 4. Re: Multiple embedded players. Playing one pauses others?
                archinla Level 1

                Thanks again kglad. That's way over my head though. I'm not a coder.

                • 5. Re: Multiple embedded players. Playing one pauses others?
                  kglad Adobe Community Professional & MVP

                  yes, i think you would be better to start with 2 swfs communicating with each other using localconnection.  check the flash help files.  there are examples of its usage.