jQuery: How do you preload sound?

Posted by aximili on Stack Overflow See other posts from Stack Overflow or by aximili
Published on 2010-05-04T04:46:07Z Indexed on 2010/05/04 5:08 UTC
Read the original article Hit count: 384

Filed under:
|
|

I have a website that plays sound when you click a button.

This is how I do it

function PlaySound(soundfile) {
    $('#soundContainer').html("<embed src='/uploads/sounds/" + soundfile + "' hidden=true autostart=true loop=false>");
}

How do you preload the sound file beforehand?

Thank you.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about sound