View Single Post
Old 12-07-2010, 12:05 AM   PM User | #12
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,565
Thanks: 62
Thanked 4,057 Times in 4,026 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
The sound file has to load from the server, first. That's the delay.

If you only have a handful of sound files you want to play, you can force them to pre-load.

Just do:
Code:
<span style="visibility: hidden;">
<embed src="xyz.wav" hidden="true" autostart="false" loop="false" />
</span>
That *should* load the file but not play it. Then, later, your JS code loads the same file, but the browser discovers it in the cache.

Not sure it works in all browsers, but give it a shot.

You need a separate <embed> for each sound file. of course, but they can all be in the one hidden <span>.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.

Last edited by Old Pedant; 12-07-2010 at 12:09 AM..
Old Pedant is online now   Reply With Quote