Reputation: 12369
When button is clicked on music is playing, but if you hit the button again, or another button. 2 or more tracks will be playing at the same time.
<script> var audio17 = new Audio("/system/voicefiles/1/original/(01) [BT feat. Jes] Every Other Way (Armin van Buuren Remix).mp3?1297492411")</script>
<div style="float:right"><input onclick="audio17.play();" type="button" value="spk" /> </div>
<script> var audio18 = new Audio("/system/voicefiles/2/original/audio2.mp3")</script>
<div style="float:right"><input onclick="audio18.play();" type="button" value="spk" /> </div>
How to make sure only one sound is playing? should I use a mutax or something?
Upvotes: 1
Views: 3002
Reputation: 13438
Try to create an array for all of your audio elements. Before playing a new file, make sure any other audio objects are stopped (loop through the array of saved audio objects and stop their playback before playing the next audio file).
Upvotes: 2