views:

12

answers:

0

Hi, I'm experimenting with sound effects for my website, the problem is the sound effects are delayed between 1 to 5 seconds.

http://theo.mypreview.co.uk/street-fighter-legacy/

Here is the script for the audio played during the page transitions effect (explosion sound only played for the second set to links)

    <script>
function EvalSound(soundobj) {
  var thissound=document.getElementById(soundobj);
  thissound.Play();
}
</script>
<embed src="http://theo.mypreview.co.uk/audio/pagetrans01.mp3" autostart=true width=0 height=0 id="sound1" enablejavascript="true">

Here is the script for the audio played during the rollover the second set of navigation links (punch sound)

var tmr = null, ebd = null;
function makesound(file) {
if (!ebd) {
var snd = document.createElement('embed');
snd.setAttribute("name", "hoversound");
snd.setAttribute("id", "hoversound");
snd.setAttribute("src", file);
snd.setAttribute("autostart", "true");
snd.setAttribute("loop", "false");
snd.setAttribute("volume", "150");
snd.setAttribute("hidden", "true");
document.getElementById("sound-holder").parentNode.appendChild(snd);
if (tmr) {
clearTimeout(tmr);
}
tmr = setTimeout('killsound()', 1500);
ebd = true;
}
else {
clearTimeout(tmr);
killsound();
return makesound(file);
}
}
function killsound() {
document.getElementById("sound-holder").parentNode
.removeChild(document.embeds['hoversound']);
ebd = null;
}

I'd like the audio to play instantaneously.

*side note firefox keeps giving me a additional plugin is required error, this seems to be something to do with the rollover script

Many Thanks