23 Replies Latest reply on Mar 9, 2016 5:21 AM by resdesign

    Many Audio in project, stop all audio instead of listing every one of them to pause

    dreaminkiss

      Hello All

      I am using the following code, to play and pause music.

       

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

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

        // Play this one

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

        // Pause this one (If it is playing)

      } else {

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

      }

       

       

      OK, looking at the 3rd line (sym.$("AldoNova")[0].pause();

      )

      If I have 100 songs in the project, I will have to list 99 songs here, and set them to pause.

      As we never know what someone is listening to at any given time.

      So. My question is the following.

       

       

      How can I pause (stop) all the other songs, when the user clicks on a song to play.

      Something like this.

       

       

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

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

        // Play this one

      $("audio").trigger("pause"); // Pause any other song that may be playing

      } else {

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

      }

       

       

      However, I have already tried this, and it does not work.

      By the way, there are no keyframes or labels for the audio, and I would LOVE to keep it that way.

       

      Wayne