|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (11 bit)
Join Date: Aug 2002
Location: BC, Canada
Posts: 1,054
|
Audio on HTML Page Question
How do I embed an audio file within an HTML page, so that when I arrive at the page, it automatically plays the file?
|
|
|
|
|
|
#2 |
|
Member (8 bit)
|
Insert this tag -
PHP Code:
So the whole tag that you put in should look like this PHP Code:
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Nov 2001
Posts: 1,965
|
Unless you really need it, I suggest against embedding audio/video files in web pages, it's quite annoying when you open a web page and some sound starts playing.
It's much better to give visitors a link to download the file instead. |
|
|
|
|
|
#4 |
|
Moderator
Staff
Premium Member
Join Date: Aug 2003
Location: Richmond, VA
Posts: 7,835
|
This is how I did it, though I did have complaints that some of the earlier versions of WMP didn't support this code:
PHP Code:
.This embed file works well, though - it offers streaming download, so the music downloads progressively as you are listening to it. The code longrawker provided is a background sound - the entire file has to be uploaded, prior to being listened. That is generally more stable - I tried that, no complaints (I meant no crahses ), except downloading time. Be cautious also for the 56kers and those with limited bandwidths on Internets - they would be quite unhappy to visit a site that would clog up their phone line - perhaps Javascript with an "if" "then" statement? ![]() Hope that helps, kram
__________________
"For today, goodbye. For tomorrow, good luck. And forever, Go Blue!"
University of Michigan President Mary Sue Coleman |
|
|
|
|
|
#5 |
|
Staff
Premium Member
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
|
I would say my top fifteen list of bad web page design in no particular order would be:
Some of those I can put up with. Audio I can't put up with, since the song plays over and over and over. Even if you set it not to loop, once someone goes to another page and comes back, it starts up again. |
|
|
|
|
|
#6 |
|
Staff
Premium Member
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
|
Note, that embed has been rejected by HTML standards makers mainly using embed depends upon a plugin, which is non-standard.
Embedding doesn't do streaming as Kram8806 because the file must be downloaded prior to playing. This is true whatever you embed, an audio file, a flash file or a java applet. Some multimedia players like Real Player will give the appearance of Streaming but not all do. |
|
|
|
|
|
#7 |
|
Member (11 bit)
Join Date: Aug 2002
Location: BC, Canada
Posts: 1,054
|
All I want to do is play a single 5-10 second sound effect when the user hits the page. Not play it over and over.
And yes, I agree with those that have posted that websites with stuff that plays over and over is very annoying. |
|
|
|
|
|
#8 |
|
PCMech: Saving Lives
Join Date: Apr 2004
Location: England, the United Kingdom
Posts: 1,839
|
My advice - if you have php/asp, or you could probably do this with javascript, make an option so that a user can turn off the music and that it remembers so that they have an option whether to have music or not.
|
|
|
|
|
|
#9 | |
|
Member (8 bit)
|
Quote:
|
|
|
|
|
|
|
#10 |
|
Member (11 bit)
Join Date: Aug 2002
Location: BC, Canada
Posts: 1,054
|
Thanks all...
I got it to work. |
|
|
|
|
|
#11 |
|
Member (12 bit)
|
www.davesite.com is the coolest site to learn HTML, they have everything there...you can also check out www.w3schools.com
|
|
|
|
|
|
#12 | |
|
Staff
Premium Member
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
|
Quote:
|
|
|
|
|
|
|
#13 |
|
Member (10 bit)
Join Date: Jul 2002
Location: University of California, Santa Barbara
Posts: 800
|
If I were you, I would never put any audio on a web page, even a 5 second clip that plays once. Why? Mainly, it's simply annoying. Web pages, as they are right now, are avenues for visual presentation (except for blind people with programs that read webpages to them), NOT audio. If I click on a link, I don't expect my speakers to blurt out some clip which may be siginificant to the web author, but completely no significance to me. It's like those really annoying banner ads that say something or play a little music.
If you do decide to go ahead with it, take WhatsThisBoxFor?'s suggestion and let users turn it off, because even if a few people like it, there are without the slightest doubt going to be a good number of people annoyed by it. |
|
|
|
|
|
#14 | |
|
Registered User
Join Date: Jun 2004
Posts: 31
|
Embeded music in web pages is just bad design. It's annoying and they usually sound like crap. Especially midi's! I cannot stand going to some crappy site and it plays even worse midi music. Blah!
As for this: Quote:
|
|
|
|
|
|
|
#15 | |
|
Staff
Premium Member
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
|
Quote:
It would be quite nice if you only had to work with one browser and one resolution but that ain't the case. Even though some people only test their site design on their own computer. |
|
|
|
|
|
|
#16 |
|
Member (11 bit)
Join Date: Aug 2002
Location: BC, Canada
Posts: 1,054
|
For those who are interested its for a friend's web page that I was talked into writing for him... He wants the sound. Im well aware of how awful it is, and have tried to talk him out of it. But he's firm that he wants it included.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|