Link to home
Start Free TrialLog in
Avatar of st
st

asked on

How to play .WAV file with HTML?

I want to make a HTML which play a .WAV file.

However, the .WAV was required to play when the HTML was opened for a while (about 30 seconds), not immediately. After another 30 seconds, it will play again.

Is is possible to write a HTML like this?

Thanks a lots.
Avatar of rafistern
rafistern

This is not an easy thing to do as the javascript functions that do this are plugin specific. Take a look at my question on this subject:
https://www.experts-exchange.com/topics/comp/lang/javascript/Q.10096903

It all depends in the end which default wav player you have.
One way would be to record a 1 minute long wav file, then just make it repeat!

<head>
<title>New Page 2</title>
<bgsound src="sound.wav" loop="-1">
</head>

Or to make it loop just twice change "-1" to "2"

If you want javascript it will only work on Netscape, IE4+ with the right plug - in.
Avatar of st

ASKER

ruperts, thanks but I don't want the .WAV file too large. Any other way?
Yes, it is possible.

For an example, see the web-page for the sci-fi movie 'Contact'
(starring Jodie Foster), at:
http://www.contact-themovie.com/sound.html

which contains the HTML:

<EMBED SRC="message.au" WIDTH="2" HEIGHT="2"
AUTOSTART="true" HIDDEN="true" LOOP="true" VOLUME="77">


like  rafistern said you will need to use JS.

you will probably need to execute a function that plays it on a using the
js time delay function.

CJ
ST, my previous answer was correct -- and it works!
ST, please explain why you "rejected" that answer.
Thanks.
Avatar of st

ASKER

Otta: It is required a silence delay before the playing the .WAV file.
Record some "delay" in the WAV (or AU) file.
Avatar of st

ASKER

otta, I wanted to use this method before I post this question. I wanted make this with HTML only, because I don't want to make change to my .wav fileS. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Otta
Otta

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial