469,643 Members | 1,514 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

Preload Audio? - Novice Needs Help

Hi - My js knowledge is pretty much cut-'n-paste, and I'd appreciate a
little guidance.I have a simple splash webpage that includes an embedded
..wav file of about 60kb. Currently, some dial-up users have pretty much
completed viewing the page before the .wav file starts playing. I'd like to
delay opening the page until the .wav file has loaded, so that the music
starts about when the viewer first sees the page. I know there's a risk of
the delay time turning off some pholks, but I'd like to try it. Is it
possible? Can someone get me started with the code? Thanks much.
~OC~
Jul 20 '05 #1
2 4919
OysterCracker wrote:
Hi - My js knowledge is pretty much cut-'n-paste, and I'd appreciate a
little guidance.I have a simple splash webpage that includes an embedded
..wav file of about 60kb. Currently, some dial-up users have pretty much
completed viewing the page before the .wav file starts playing. I'd like to
delay opening the page until the .wav file has loaded, so that the music
starts about when the viewer first sees the page. I know there's a risk of
the delay time turning off some pholks, but I'd like to try it. Is it
possible? Can someone get me started with the code? Thanks much.


Put up a blank page, with:
<body onload="document.location.href="realPage.html"'>
<code here to play the wav>

When the .wav gets loaded, it will set the page to the actual page.
Since the .wav *should* then be in the cache, it will play.

What you have done though is now pissed off a lot of people that have
had to sit and look at a blank page while your unwanted sound is loaded.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #2

"OysterCracker" <oc@sc.rr.nononono.com> wrote in message
news:Gd*********************@twister.southeast.rr. com...
completed viewing the page before the .wav file starts playing. I'd like to delay opening the page until the .wav file has loaded, so that the music

I was intrigued by your question, and went searching. Found this (at
http://www.webreference.com/javascri...16/source.html) and created a
working example from it. I have no idea how this works in anything other
than ie. The key is document.*mysound*.play() - *mysound* refers to the name
given in the embed tag, where the source file is also identified.

<html>
<head>
<title></title>

<script>

function playWav() {

document.mysound.play();
}
</script>


<body onload="playWav();">

<EMBED SRC = "SOUND1.WAV"
HIDDEN = TRUE
CONTROLS = console
VOLUME = 100
LOOP = FALSE
AUTOSTART = FALSE
NAME = "mysound"
MASTERSOUND>

the rest of the webpage.....
</body>
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by MALdito | last post: by
3 posts views Thread by Bruce | last post: by
2 posts views Thread by Albert Spencil | last post: by
1 post views Thread by Peter Fastré | last post: by
1 post views Thread by Andrew Poulos | last post: by
7 posts views Thread by Andrew Poulos | last post: by
1 post views Thread by Ron Provost | last post: by
6 posts views Thread by Quentin | last post: by
2 posts views Thread by Davd S. Zuza | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.