4

I have multiple audio players on the same page (maybe 50) and I want the one that is currently playing to stop playing when pressing play on another audio player.

For each player, I have the following audio code, where the audio-id is unique and the same is true for the URL to the song, but other than that each player is controlled using the built in controls via controls="controls". So the full code snippet for one of the audio players looks like this:

<audio  id="audio_76cb1e62" src="rc_images/sunrise_instrumental_90.mp3" controls="controls"></audio>

How do I add a script that will stop the player that is currently playing when pressing play on another player - what will the script look like?

0 Answers0