...

View Full Version : preloading sound



qwertyuiop
11-09-2004, 02:18 AM
Hello,
I've searched all over the internet and I just did a quick search here, but I couldn't find my answer. How would I preload several sound files? I want the files to preload as soon as the page is loaded. Then, when the user activates the sound, it will play without any delay.

Willy Duitt
11-09-2004, 03:35 AM
In the past we used the <embed> tag...
But I would suggest that you look into using the <object> tag for forward compatability....



<embed autostart="false" hidden="true" src="mySound.wav">

.....Willy

qwertyuiop
11-09-2004, 04:29 AM
Does <object> work with older browsers? What if I wanted to preload several sounds? Would I just do the following:?

<embed autostart="false" hidden="true" src="mySound.wav">
<embed autostart="false" hidden="true" src="mySound2.wav">
<embed autostart="false" hidden="true" src="mySound3.wav">

Is this the most reliable and effective way to preload sounds? What's wrong with a javascript version?

Thanks for replying, sorry if I ask tooo many questions.

Philip M
11-09-2004, 07:31 AM
"I want the files to preload as soon as the page is loaded. Then, when the user activates the sound, it will play without any delay."

This works in IE only:-

<EMBED src="boathorn.wav" hidden="true" autostart="false" name="horn">
<bgsound id="sound">

<SCRIPT language="JavaScript">
function playhorn()
{
if (document.all) {document.all.sound.src = "boathorn.wav"}
}
</SCRIPT>

When the function playhorn() is called the horn sounds.

You could preload several sounds by making bgsound id="sound2" etc.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum