[ Go To Scripts Index | Music Index | Music and Sound Players | Multiple Track Players | Video Players ]

How to include Music and sound with the object tag

<OBJECT ID="MediaPlayer" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" WIDTH="pixels" HEIGHT="pixels">
<PARAM NAME="FileName" VALUE="midi.mid">
<PARAM NAME="AutoRewind" VALUE="true | false">
<PARAM NAME="Balance" VALUE="-10000 | 0 | 10000">
<PARAM NAME="AutoStart" VALUE="true | false">
<PARAM NAME="ShowDisplay" VALUE="true | false">
<PARAM NAME="ShowControls" VALUE="true | false">
<PARAM NAME="ShowTracker" VALUE="true | false">
<PARAM NAME="PlayCount" VALUE="value">
</OBJECT>

Make sure you replace "midi.mid" with the real file name, "true | false" with either true or false, and "pixels", "value" and "-10000 | 0 | 10000" with a number.

What It Means

Below is a list of what everything means:

WIDTH="pixels"
Defines the width of the embedded object in pixels.

HEIGHT="pixels"
Defines the height of the displayed object in pixels.

NAME="FileName" VALUE="midi.mid"
The URL at which the sound file can be found. * Required

NAME="AutoRewind" VALUE="true | false"
Controls whether Media Player automatically returns to the beginning of the selection when it reaches the end of the selection.

NAME="Balance" VALUE="-10000 | 0 | 10000"
Controls the left/right stereo balance of any audio. -10000 is 100% left speaker, 10000 is 100% right speaker, and 0 is perfectly balanced.

NAME="Autostart" VALUE="true | false"
Controls whether the Media Player automatically plays the file when the page is done loading.

NAME="ShowDisplay" VALUE="true | false"
Controls if the title and artist of the clip are shown.

NAME="ShowControls" VALUE="true | false"
Controls if the play, pause, stop, etc buttons are shown.

NAME="ShowTracker" VALUE="true | false"
Controls if the play tracker is shown.

NAME="PlayCount" VALUE="value"
Controls the number of times the file is played. A value of 0 repeats forever.

Make your own buttons

You can even make your own play/stop/etc buttons. The ONCLICK commands can be added to images also.

Hide Display
<INPUT TYPE=button VALUE="Hide Display" ONCLICK="MPlyr.ShowDisplay=false">

Show Display
<INPUT TYPE=button VALUE="Show Display" ONCLICK="MPlyr.ShowDisplay=true">

Show/Hide Controls
<INPUT TYPE=button VALUE="Show/Hide Controls" ONCLICK="MPlyr.ShowControls=(MPlyr.ShowControls==true?false:true)">

Show/Hide Tracker
<INPUT TYPE=button VALUE="Show/Hide Tracker" ONCLICK="MPlyr.ShowTracker=(MPlyr.ShowTracker==true?false:true)">

Play Button
<INPUT TYPE=button VALUE="Play" ONCLICK="MPlyr.Play()">

Stop Button
<INPUT TYPE=button VALUE="Stop" ONCLICK="MPlyr.Stop()">

Pause Button
<INPUT TYPE=button VALUE="Pause" ONCLICK="MPlyr.Pause()">

You can add style to your buttons like this.....      
<INPUT TYPE=button VALUE="Play" ONCLICK="MPlyr.Play()" style="background-color:lightgreen">
<INPUT TYPE=button VALUE="Pause" ONCLICK="MPlyr.Pause()" style="background-color:pink">
<INPUT TYPE=button VALUE="Stop" ONCLICK="MPlyr.Stop()" style="background-color:hotpink">



Example

This code:
<OBJECT ID="MediaPlayer" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">
<PARAM NAME="FileName" VALUE="filename.mid">
<PARAM NAME="AutoRewind" VALUE="true">
<PARAM NAME="Balance" VALUE="-10000">
<PARAM NAME="AutoStart" VALUE="false">
<PARAM NAME="ShowDisplay" VALUE="false">
<PARAM NAME="ShowControls" VALUE="false">
<PARAM NAME="ShowTracker" VALUE="false">
<PARAM NAME="PlayCount" VALUE="0">
</OBJECT>

<INPUT TYPE=button VALUE="Show/Hide Controls" ONCLICK="MPlyr.ShowControls=(MPlyr.ShowControls==true?false:true)">
<INPUT TYPE=button VALUE="Play" ONCLICK="MPlyr.Play()">
<INPUT TYPE=button VALUE="Pause" ONCLICK="MPlyr.Pause()">


Here is the results:

[ Go To Scripts Index | Music Index | Music and Sound Players | Multiple Track Players | Video Players ]