There are several button codes for playing audio on the page as follows: how to automatically pause the current audio and other audio?

how can I automatically pause the current audio and other audio when there are multiple buttons to play audio on the

page?

related codes

       <ul>
       
          <li v-for="(item , index) in list" :key="index">
              <audio :src="item.mp3"></audio>
              <span></span>
          </li>

      </ul>
Sep.01,2021

if the playback is current, other stops may be easier to handle. There is only one playback entity on the entire page, and the button controls the audio playback entity to load different content.

of course, your request can also be achieved. You need to enumerate all the audio players on the current page (numbered), then force a pause, and then play the current one, that is, you can't use the default audio playback control button. Instead, you need to customize the corresponding buttons.

Menu