Play multiple sounds at the same time
P粉832212776
2023-08-13 16:14:48
<p>Using HTML 5, I want to play multiple sounds at the same time. How do I do this? </p>
<p>Here is my current code: </p>
<pre class="brush:html;toolbar:false;"><audio controls="controls">
<source src="audio/(TESBIHAT).mp3" type="audio/mpeg" />
<source src="audio/Dombra.mp3" type="audio/mpeg" />
<embed height="50px" width="100px" src="audio/(TESBIHAT).mp3" />
<embed height="50px" width="100px" src="audio/Dombra.mp3" />
</audio>
</pre>
Using JavaScript and the HTML5 Audio API, you can do something like this:
I tested in Chrome v. 20 and it seems to work :)
The<source>
tag is used to specify different formats of the same file - this way the browser can choose another format as a fallback if the first format is not supported. That's why your own proposed solution doesn't work.