Meta Question

fireside's avatar

How do I make a web page that plays sound upon page load?

Asked by fireside (12302points) October 8th, 2008

This is for the highly practical application of playing audio files with my linked comments on Fluther…

I use php on my site.

Observing members: 0 Composing members: 0

12 Answers

Anaphase's avatar

Stick this in your <body> tag: <embed src=“THE NAME OF YOUR FILE.mp3” autostart=true width=0 height=0>

fireside's avatar

And I if just wanted a blank page with the audio, I could use the same tag without the <body> tag, or no?

tonedef's avatar

You don’t, as this is considered horrible nettiquette. Put a play button on the page!

fireside's avatar

good idea

Anaphase's avatar

@fireside You can have body tags and still have no content displayed. But I do believe that it would work without <body> tags.

squirbel's avatar

I agree with tonedef – this is a horrible practice. You should give the visitors an option to play, with the music turned off from get go.

Bri_L's avatar

@anaphase – That is so cool you know how to do that BAM just like that. lurve.

bodyhead's avatar

It is horrible netiquette to have anything play on page load. The only way you would be able to offset this flagrant disregard of Internet rules is to make sure you include no less then 15 dancing baby gifs somewhere on the page.

fireside's avatar

ooo, dancing baby gifs!!!
Good idea!

got to work now, but will try something out later tonight if possible. thanks everyone

bodyhead's avatar

Seriously though, if you don’t mind doing a little reading I would suggest this article which explains building a pop up mp3 player that the user can shut off. I think it comes across as being pretty slick without any fancy coding.

There’s links to some other articles in there which have different methods for building players.

Keep your bandwidth in mind. The reason that a lot of old sites would use midis in the background is because you didn’t have to stream a very large file to all your users. Once you start streaming an mp3, assuming you’re on a basic shared server webhosting, you’ll be able to stream the audio to maybe five or ten people at the same time before it starts to crack and sputter (for everyone).

If you’re hosting the webserver on Apache at your own house, it might be less then that.

lapilofu's avatar

If you just want a blank page with audio, you might as well just provide a link directly to the MP3 file. Let the user and their computer decide how it displays and plays.

wilhel1812's avatar

what tonedef said.

Answer this question




to answer.
Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
Knowledge Networking @ Fluther