Play audio in javascript with a good performance

Posted by João on Game Development See other posts from Game Development or by João
Published on 2013-08-02T04:24:51Z Indexed on 2013/08/02 16:07 UTC
Read the original article Hit count: 295

Filed under:
|
|

I'm developing a browser game where the player can shoot. Everytime he shoots it play a sound.

Currently i'm using this code to play sounds in JavaScript:

    var audio = document.createElement("audio");
    audio.src = "my_sound.mp3";
    audio.play();

I'm worried about performance here. Will 10 simultaneous sounds impact my game performance too much?

Will all audio objects stay in memory even after they are played?

© Game Development or respective owner

Related posts about JavaScript

Related posts about html5