JavaScript Play Two Sounds at Once

Anyone following my blog may know I have undertaken 3D web development. This includes games and other 3D content for websites. Sound is particularly important to video game development. When it comes to building games with JavaScript, we have to know how to handle multiple sound files at once.  I actually tried a lot of tricks before I found this simple jQuery solution that works:

<script src=””></script>
$(document).ready(function() {
console.log( “Ian says the document is ready!” );
var audio = new Audio(‘sounds/beat.mp3’);;
var audio2 = new Audio(‘sounds/song.mp3’);;
});//end doc ready fun

Leave a Reply

Your email address will not be published. Required fields are marked *