Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 07-03-2004, 01:55 AM   #1
Member (11 bit)
 
TheJackal's Avatar
 
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?
TheJackal is offline   Reply With Quote
Old 07-03-2004, 03:48 AM   #2
Member (8 bit)
 
Join Date: Jun 2004
Location: South Bucks, England
Posts: 160
Send a message via AIM to longrawker Send a message via MSN to longrawker
Insert this tag -
PHP Code:
<BGSOUND SRC="insert url of sound" LOOP=insert # or infinate> 
and it should work.

So the whole tag that you put in should look like this
PHP Code:
<BGSOUND SRC="http://www..." LOOP=1
longrawker is offline   Reply With Quote
Old 07-03-2004, 10:57 AM   #3
aym
Registered User
 
aym's Avatar
 
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.
aym is offline   Reply With Quote
Old 07-03-2004, 11:14 AM   #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:
<embed width="128" height="10" src="musicfile.mp3" hidden>
<
noembed>Alternate text.</noembed
With embed, you may also have trouble getting all visitor's browser to support it...I tried many types of codes, all of which I've either crashed someone's MSIE or Firefox, or I've crashed their computer .

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
kram 2.0 is offline   Reply With Quote
Old 07-03-2004, 11:19 AM   #5
Staff
Premium Member
 
mairving's Avatar
 
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:
  • Songs that play over and over with no option to turn off
  • Blinking, moving, flashing things.
  • Frames
  • Intro pages
  • Under Construction signs.
  • Poor Page Navigation
  • No or very poor logo
  • Best viewed with *****, in ***** resolution.
  • Pages that open in new windows for no reason.
  • Horizontal Scrolling.
  • Pages that are too long.
  • Dead Links
  • Page Counters
  • Guestbooks
  • Poor use of images

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.
mairving is offline   Reply With Quote
Old 07-03-2004, 11:30 AM   #6
Staff
Premium Member
 
mairving's Avatar
 
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.
mairving is offline   Reply With Quote
Old 07-03-2004, 01:39 PM   #7
Member (11 bit)
 
TheJackal's Avatar
 
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.
TheJackal is offline   Reply With Quote
Old 07-03-2004, 01:43 PM   #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.
__________________
WhatsThisBoxFor? is offline   Reply With Quote
Old 07-04-2004, 01:56 PM   #9
Member (8 bit)
 
Join Date: Jun 2004
Location: South Bucks, England
Posts: 160
Send a message via AIM to longrawker Send a message via MSN to longrawker
Quote:
Originally posted by TheJackal
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.
Then set loop as 1. <... loop=1> And it will play once, upon opening the page, and stop.
longrawker is offline   Reply With Quote
Old 07-04-2004, 03:33 PM   #10
Member (11 bit)
 
TheJackal's Avatar
 
Join Date: Aug 2002
Location: BC, Canada
Posts: 1,054
Thanks all...

I got it to work.
TheJackal is offline   Reply With Quote
Old 07-04-2004, 03:36 PM   #11
Member (12 bit)
 
icallmedan's Avatar
 
Join Date: Mar 2003
Posts: 2,309
Send a message via AIM to icallmedan
www.davesite.com is the coolest site to learn HTML, they have everything there...you can also check out www.w3schools.com
icallmedan is offline   Reply With Quote
Old 07-04-2004, 04:50 PM   #12
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
Quote:
Originally posted by longrawker
Then set loop as 1. <... loop=1> And it will play once, upon opening the page, and stop.
It will play once upon opening the page and then also play again everytime you return to the page. So if you click on a link, then click the back button, it will start playing again.
mairving is offline   Reply With Quote
Old 07-04-2004, 08:50 PM   #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.
mattg2k4 is offline   Reply With Quote
Old 07-05-2004, 01:23 AM   #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:
Best viewed with *****, in ***** resolution.
That's not too bad of a thing. Some sites' layouts were designed strictly for larger resolutions. Smaller resolutions are just too small to fit everything they are wanting to fit. 2advanced.com is a good example. I personally try to make all the layouts I make fluid. That's when they expand/contract to different resolutions for those of you who don't know what it means :P
GimmeDaMic is offline   Reply With Quote
Old 07-05-2004, 06:41 AM   #15
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
Quote:
Originally posted by GimmeDaMic

That's not too bad of a thing. Some sites' layouts were designed strictly for larger resolutions. Smaller resolutions are just too small to fit everything they are wanting to fit. 2advanced.com is a good example. I personally try to make all the layouts I make fluid. That's when they expand/contract to different resolutions for those of you who don't know what it means :P
The main problem with that is that it is very old school. A throwback to the days when they had best viewed with Netscape 4.0. The biggest beef is that you are telling the viewer what browser they should use and what resolution they should use rather than adapt to them.

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.
mairving is offline   Reply With Quote
Old 07-05-2004, 12:40 PM   #16
Member (11 bit)
 
TheJackal's Avatar
 
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.
TheJackal is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:48 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2