Forum Moderators: open
However, this doesn't seem to work. I am trying this out on IE6 and Firefox 2.0
What is it that I am missing out on? IS there a different code for this version of IE and Firefox?
Also, can I embed a .amr file to play as background music?
Please help!
You do NOT want to force a sound on anyone. It is annoying and obtrusive. However, if you want to allow someone the OPTION of hearing sound, there are a couple ways to do it. In my case, the sound is associated with an item for sale in which the sound is important.
The problem is that browsers don't agree on how to play a sound, requiring different plugins or methods. The one you use is half of the equation and only good for old Netscape browsers - modern browsers use the <object> element, but even that will present problems across browsers. Old ways of doing it would be to put the <embed> tag inside the <object> tag, so would satisfy browsers that recognized each. But as said, this is outdated and as you can see doesn't always work.
There are many Javascript tut's on the web that demonstrate how to do this by identifying the plugins required for sound, but many of these are alos outdated and additionally this makes your sound Javascript-dependent, and is still bereft with compatibility issues.
The only solid, reliable way to present a sound is to embed the sound in a Flash object and provide a start/stop control. True, this makes the sound control Flash dependent, but that is a lot better than other options - and, it completely negates browser compatibility issues. It also allows you to stream the sound, allowing it to play as it downloads, which is better than a download-and-wait-hope-it-works.
<OBJECT ID="mediaPlayer"
CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
CODEBASE="http://activex.microsoft.com/activex/
controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
STANDBY="Loading Microsoft Windows Media Player components..."
TYPE="application/x-oleobject">
<PARAM NAME="filename"
VALUE="narcacepticle - born to loose.mp3">
<PARAM NAME="transparentatStart" VALUE="true">
<PARAM NAME="autoStart" VALUE="false">
<PARAM NAME="showControls" VALUE="true">
<PARAM NAME="volume" VALUE="-200">
<param name="PlayCount" value="10">
</OBJECT>
here's the thing - I am planning a music resources related simple static website. A lot of people I spoke to told me that they expect some sort of music on a music related website. Frankly, I am not to keen on adding music to the site unless I can give a choice to play music or not.
<a href="mymusic.amr">Play background music</a> this is another option I could find but it does not work on Firefox...
At the moment, I am not planning on using any Flash...so what is the general consensus - stay away from adding music?
stay away from adding music?
I would use a Flash player if I needed to add music, but don't add it just for the sake of adding it.
Don't auto-play, as this intrusively assumes control of visitors' speakers. If their speakers are on, there is a fair chance they're already listening to something. Clashing music is a very unpleasant introduction to any site.