开发者

Throw away sound effects in Javascript using HTML5 audio?

I'm building a simple game using a canvas tag and want to add some sound effects to it. If I use the following code to play the SFX...

function playSfx( sound ) {
 var snd = new Audio("file.mp3");
 snd.play();
}

Is the garbage collection / memory management clever enough to play the sound and then dispose of the Audio object? Or will I have to keep track of the object and destroy it开发者_C百科 when it has finished playing?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜