PDA

View Full Version : playing an mp3


Ludootje
05-24-2002, 05:51 PM
Hi,
a friend of mine is writing a music site, and wants to let an mp3 play when people see the webpage. Is this possible using javascript, or is this even in html possible (although I doubt about the latter)?

Thanks,

Ludootje

xilica
05-24-2002, 07:45 PM
It is possible through HTML.

In the body tag, put this in it bgsound="sourceofsonghere", so in the body tag have <body bgsound="sourceofsonghere">:)

Bradmont
05-24-2002, 10:04 PM
Forcing sound on a visitor is detested by many users. Many people disable sound in thier browsers altogether. I'd suggest just putting a link to the song instead of having it playing in the background.

xilica
05-24-2002, 10:11 PM
Originally posted by Bradmont
Forcing sound on a visitor is detested by many users. Many people disable sound in thier browsers altogether. I'd suggest just putting a link to the song instead of having it playing in the background.

Jeeze, AND I GET HATE MAIL FOR flaming that was spam and flame bradmont.... yes it is dont lie ... by the way...... since you mentioned that bradmont why dont u post how to do it...... or i am i gonna hvae to edit this posts and put it? dont spam again!!!!!!!!!

inkedmn
05-24-2002, 10:26 PM
that's EXACTLY what i'm talking about.

Ludootje
05-25-2002, 06:33 AM
Ok thanks a lot xilica.
Bradmont: yep thought about that, but there's not so much wrong with it, if it's a musc site. Don't know if you noticed, but most (music)sites have background music. I think that it might be better to let it play by default, and add a button so they can stop the song. Is this possible? Or is some sort of web-based mp3player possible, like some sort of list, and that by selecting a song it plays? I know in flash it's possible, but in javascript/html...

Also, how is it possible to let it play a song using a button? I searched on javascript sites, but couldn't find anything (useful) when searching for "streaming" & "mp3"...

TIA

xilica
05-25-2002, 11:38 AM
Yes, you can have music play at the click of a button!
Use: <embed src="source">

There are other attributes which can go into that tag, so if you have any other Q's, just ask about it!

gish
05-25-2002, 12:14 PM
I don't think you can add a .mp3 file.....it really depends on the browser and the OS.....are you trying to stream the media....IE just links to the source file.....and will open the default media player...this is juts of the top off my head....I have tried my self embedding a mp3 file and was unsuccessfull....but perhaps there is a javascript function that could be created.......

Gish

Ludootje
05-25-2002, 12:50 PM
So what should be used than? .wav? Or .ram?

xilica: wow that's nice, I didn't know html had that much options, I thought it was much more basic and that for stuff like this javascript was the only solution (besides java & flash, that is). How does the <embed> tag works exactly? You're talking about other options...?

xilica
05-25-2002, 01:41 PM
You can use whatever you want..... .wav or .ram

The other options i mentioned were to get the screen without the little bar by clicking on the screen to start and stop and making the screen a fixed size. Also, to use the <embed> tag to embed the source of the song whereever you want to.

DukeofNukes
05-25-2002, 02:53 PM
Gish, however, is right when he says you can't embed mp3; midi, wav, and the various Real and Quicktime formats (the latter two only if your viewer has the appropriate plugins) are the ones supported by most browsers. If your user has IE 5.5 or later (and yes, most folks do, but don't forget those of us who don't always use it), you can embed stuff that Windows Media Player 7 or later can play. There's no way to get me --and many other folks -- to leave a site more quickly, though, than to embed a sound and not make it painfully obvious how to turn it off, so I'd advise that your friend put his "cut this stuff off" button someplace prominent.

xilica
05-25-2002, 03:26 PM
Well,yes, embedding sound is the second top thing that makes a website horrible.

Ludootje
05-25-2002, 04:39 PM
xilica: what's the first ;)
Personally, if the music is good, and if it's a music-related site, I have no problem with it.

xilica
05-25-2002, 04:47 PM
the first is using flashing text