Best way to play wav files in the browser?

Splatzone picture Splatzone · Jul 24, 2009 · Viewed 33.8k times · Source

I have no choice but to play wav files directly in the browser (serverside encoding to mp3 isn't an option, unfortunately.)

What's the best way to do this? I'd really like to take advantage of the HTML 5 audio tag but my target audience includes many, many teens using IE6. As far as I'm aware flash isn't an option, but speedy playback really is critical.

Thanks.

Answer

Robert Harvey picture Robert Harvey · Jul 24, 2009

Nowadays, the best way is probably just to use the HTML5 <audio> tag. In the past, you might have done it like this:

Background:

<embed src="bgsound.wav" hidden="true" autostart="true" loop="1">

On Click:

<a href="success.wav">Play Sound</a>