Preload Audio? - Novice Needs Help

O

OysterCracker

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~
 
R

Randy Webb

OysterCracker said:
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.
 
F

fenian

OysterCracker said:
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/javascript/960916/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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top