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.

AddThis Social Bookmark Button

11 Responses to “HTML Code to Auto-Play MP3 Audio Files”

  1. 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,

  2. 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.

  3. You do know that you can use the tag to display HTML as text?

  4. The tag?

  5. It’s

    the PRE tag.

    > pre

  6. 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.

  7. 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??

  8. That’s what I coded from what you posted.

  9. <embed src=’Music.wav’ autostart=’true’ volume=’90′ hidden=’TRUE’ height=’0′ width=’0′>

    - Had to re-edit it

  10. That works for me, thanks!

Leave a Reply

MENU

Home
Contact
Performance Dates
Resume