HTML Code to Auto-Play MP3 Audio Files
Autoplay of audio files has long been considered bad form for websites, but I just can’t help myself. It’s just too fun. I’ve set a piece to play at the entrance of my site and will setup a short audio sample to play on the front of my blog.
You don’t have to embed in a flash player, and you can call up whatever audio format you want (.wav, MP3. .ra, etc.). If you are super evil like me you can set the file to “hidden - true” so no one can turn the music off. My front page is a splash page so if people don’t like the song they can always click to another section.
Here’s the code to autoplay MP3 audio music files on your website page:
***********
embed src=’Music.wav’ autostart=’true’ volume=’90′ hidden=’TRUE’ height=’0′ width=’0′
*********************
NOTE: You will need to put a “<” at the beginning of code and a “> ” at the end. I couldn’t post it with the tags because my blog think’s it is HTML code (which it is).
Autostart - is to automatically start the song playing.
Hidden - is setting for audio controls.
If control is hidden then dimensions are not shown anyway.
Replace URL with exact location of your audio file.
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
November 24th, 2006 at 4:58 am
Hi, I’ve been trying to play mp3 at my Yahoo360 blog. So I was very glad to find your instruction. However, when I pasted your code in my blog, and tried to preview it, I saw nothing. Apparently Yahoo360 doesn’t recognize it.
Do you know how to solve the problem?
My sincere thanks,
November 24th, 2006 at 1:57 pm
If I post that code within a post here on my blog it won’t play either - I had to put it into the sidebar to make it play. I’ve tried it also on MySpace.com posts but won’t work either - Needs to be in the main source code of the page. Might not work as a blog post.
Also, see the note on the post for the “< " and ">” symbols to be put on the outside of code.
If you post it on a regular html page you have total control of, it should work. I had it running here for several days on my site, but took it down - I get too many hits and the audio was getting garbled from the bandwidth.
August 12th, 2007 at 10:37 am
You do know that you can use the tag to display HTML as text?
August 12th, 2007 at 10:37 am
The tag?
August 12th, 2007 at 10:38 am
It’s
the PRE tag.
> pre
August 12th, 2007 at 2:49 pm
http://www.w3schools.com/tags/tag_pre.asp
September 12th, 2007 at 1:07 pm
i would like to know how can use this code html but with many songs, for example i would kie that in my website if you enter there, the music autostart but all the songs in order.
December 21st, 2007 at 1:20 am
I get all of it but the “Embed xsrc=”
What does that mean??
Is there any way to write an html code for an audio file??
April 22nd, 2008 at 7:24 am
That’s what I coded from what you posted.
April 22nd, 2008 at 7:25 am
<embed src=’Music.wav’ autostart=’true’ volume=’90′ hidden=’TRUE’ height=’0′ width=’0′>
- Had to re-edit it
May 7th, 2008 at 5:19 pm
That works for me, thanks!