How would I go about embedding a .wav file into my site the most simple way possible.

1 answer

This was chosen as the best answer

HTML 5's <audio> tag is perfect for handling this (and conveniently, it looks like you're already using the html5 doctype in your document). Unfortunately, versions of Internet Explorer older than 9 ( = 50-60% of Internet users) don't support this, and Google Chrome doesn't support the .wav format.

To cover the vast majority of browsers, you'll want to all make an .ogg version of the file available (you should be able to use this site to do the conversion, buried somewhere behind all of the advertisements). You can then include both the .wav and .ogg files and use Flash (or maybe Embed) as a fallback.

<audio controls="true" autoplay="true">
    <source src="yourfile.wav" />
    <source src="yourfile.ogg" />
    <embed src="yourfile.wav" autostart="true" hidden="true" />

I'm not sure if that "embed" part will work, but including elements other than "" inside the audio element should use them as fallbacks if the browser can't play html5 audio. If embed doesn't work, you can definitely use this technique to fall back to a flash player.

"html5 Doctor" has an excellent guide for this topic:

Answered almost 7 years ago by Michael Martin-Smucker
  • Thank you so much this worked amazingly and it is very pretty default player, this is awesome. Take a look at our song and let me know what you think. Anders ak Kitson almost 7 years ago