Forum Moderators: open

Message Too Old, No Replies

Playing music on website intro.

         

dange

12:29 am on Oct 18, 2007 (gmt 0)

10+ Year Member



Here is the current code:

<!-- START HOME MUSIC CODE


if (navigator.appName == "Microsoft Internet Explorer") {
6document.write('<bgsound src="intro.mp3" LOOP="false">');
}
else {
document.write('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" Name="MediaPlayer" src="intro.mid" AutoStart="true" ShowStatusBar="0" ShowControls="0" ShowDisplay="0" volume="-1" HEIGHT="1" WIDTH="1" loop="false"><br>');
}

// End -->


I see that it's checking for IE but how do I also make this work in Firefox?

Thanks!

phranque

2:16 am on Oct 18, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I see that it's checking for IE but how do I also make this work in Firefox?

"ummm... you can't", he says with an evil grin slowly curling his lips.

phranque

2:36 am on Oct 18, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



oops - my bad!

welcome to WebmasterWorld, dange!

you might try adding some <param> tags and enclosing the param/embed tags in an <object> tag.
most people around here will discourage you from adding background music to your site...

[webmasterworld.com...]

dange

2:55 am on Oct 18, 2007 (gmt 0)

10+ Year Member



I would agree, with you phranque, about not adding background music but this isn't my choice ;x

phranque

3:18 am on Oct 18, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you could try something like this:

<object id="mediaPlayer" width="1" height1"
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="Name" value="MediaPlayer" />
<param name="src" value="intro.mid" />
<param name="AutoStart" value="true" />
<param name="ShowStatusBar" value="0" />
<param name="ShowControls" value="0" />
<param name="ShowDisplay" value="0" />
<param name="volume" value="-1" />
<param name="HEIGHT" value="1" />
<param name="WIDTH" value="1" />
<param name="loop" value="false" />
<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" Name="MediaPlayer"
src="intro.mid"
AutoStart="true" ShowStatusBar="0" ShowControls="0" ShowDisplay="0" volume="-1" HEIGHT="1" WIDTH="1" loop="false">
</embed>
</object>

dange

12:57 pm on Oct 18, 2007 (gmt 0)

10+ Year Member



haha well I guess they forgot to tell me that there is no intro.mid file in the directory so that's the only reason it wasn't playing.

Thanks!

JAB Creations

7:07 pm on Oct 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My site has had music and a music intro for a few years now. There are some major golden rules you have to take in to account...

- Surfers often are already listening to their own music.

- Surfers don't inherently have an easy method of pausing their music.

- Surfers don't inherently want to pause their music for a website.

- Surfers prefer making a choice to enable site audio versus having to disable it.

With that in mind you should do at least two things...

1.) Create an option to enable site audio with it disabled by default.

2.) Use Flash...the method you're using might stream and I'm not sure because the method is proprietary anyway. This is a rare example of when I do use Flash.

Some sites are more subjective to users preferring audio. It's always a good choice to ask your site's visitors what they think.

My site still has an audio introduction although you'll at best only hear it on the second visit if you have enabled site audio.

- John