WMP Script

Y

Yonder

Got a little problem with Javascript. I control windows media player
with buttons and hide the actually windows media player.

My JS:
---------------------------------------------------------------------------------
var WMState = new Array();

WMState[0] = "Loading";
WMState[1] = "Stopped";
WMState[2] = "Paused";
WMState[3] = "Playing";
WMState[4] = "Scan Forward";
WMState[5] = "Scan Reverse";
WMState[6] = "Buffering";
WMState[7] = "Waiting";
WMState[8] = "Media Ended";
WMState[9] = "Buffering";
WMState[10] = "Ready";
WMState[11] = "Reconnecting";

function Status () { x = Player.playState;
alert(WMState[x]);
}

function Play () { x = Player.playState; if (x == 2)
{ Player.controls.play(); } else { Player.URL = "http://
www.emapdigitalradio.com/emapdigitalradio/metafiles/key103.asx"; }
}
function Pause ()
{
Player.controls.pause();

}

function Stop () { Player.controls.stop(); } function MuteMe () { x =
Player.settings.mute; if (x == 0) { Player.settings.mute = "1"; } else
{
Player.settings.mute = "0";

}
}

function UnMuteMe () {
Player.settings.mute = "0";


}

function VolumeUp () {
X = Player.settings.volume;

Player.settings.volume = X + 10;
} function VolumeDown () { X = Player.settings.volume;

Player.settings.volume = X - 10;
}
---------------------------------------------------------------------------------

My html body:
---------------------------------------------------------------------------------

<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
name="Player" width="0" height="0" standby="Loading" codebase="http:/
activex.microsoft.com/activex/controls/mplayer/en/
nsmp2inf.cab#Version=6,4,5,715">

<param name="url" value="http://www.emapdigitalradio.com/
emapdigitalradio/metafiles/key103.asx" ref />

<param name="autostart" value="-1" />
<param name="Volume" value="50">

<param name="uimode" value="invisible" />
<param name="rate" value="1">
<param name="balance" value="0">
<param name="currentPosition" value="0">
<param name="defaultFrame" value>
<param name="playCount" value="1">
<param name="currentMarker" value="0">
<param name="invokeURLs" value="-1">
<param name="baseURL" value>
<param name="mute" value="0">
<param name="stretchToFit" value="0">
<param name="windowlessVideo" value="0">
<param name="enabled" value="-1">
<param name="enableContextMenu" value="-1">
<param name="fullScreen" value="0">
<param name="SAMIStyle" value>
<param name="SAMILang" value>
<param name="SAMIFilename" value>
<param name="captioningID" value>
<param name="enableErrorDialogs" value="0">
<embed src="http://www.emapdigitalradio.com/emapdigitalradio/
metafiles/key103.asx" width="145" name="Player" height="40"
autostart="True" controls="playbutton" showstatusbar="false"
url="http://www.emapdigitalradio.com/emapdigitalradio/metafiles/
key103.asx" autoplay="true" uimode="invisible"> </embed></object>

<table border="0" width="436" height="133">
<tr>
<td height="21" width="124" colspan="2"></td>
<td height="21" width="302" colspan="4">
</td>
</tr>
<tr>
<td height="74" width="52" align="center"><font face="Verdana"
size="1"><INPUT TYPE="image" NAME="BtnPlay" VALUE="Play"
src="play.png" accesskey=p OnClick="Play()"></font></td>
<td height="74" width="68" align="center"><font face="Verdana"
size="1">

<INPUT TYPE="image" NAME="BtnStop" VALUE="Stop"
src="stop.png" accesskey=s OnClick="Stop()"></font></td>
<td height="74" width="77" align="center"><font face="Verdana"
size="1">

<INPUT TYPE="image" NAME="BtnMute" src="unmute.png"
VALUE="Mute" accesskey=m OnClick="MuteMe()"></font></td>
<td height="74" width="75" align="center"><font face="Verdana"
size="1">

<INPUT TYPE="image" NAME="BtnUnMute" VALUE="UnMute"
src="mute.png" accesskey=m OnClick="UnMuteMe()"></font></td>
<td height="74" width="66" align="center"><font face="Verdana"
size="1">

<INPUT TYPE="image" NAME="BtnVolUp" VALUE="VolUp"
src="volup.png" accesskey=u OnClick="VolumeUp()"></font></td>
<td height="74" width="72" align="center"><font face="Verdana"
size="1">

<INPUT TYPE="image" NAME="BtnVolDown" VALUE="VolDown"
src="voldw.png" accesskey=z OnClick="VolumeDown()">
<INPUT TYPE="button" NAME="BtnSts" VALUE="Status"
OnClick="Status()"></font></td>
</tr>
<tr>
<td height="22" width="52" align="center"><font face="Verdana"
size="1">
Play</font></td>
<td height="22" width="68" align="center"><font face="Verdana"
size="1">
Stop</font></td>
<td height="22" width="77" align="center"><font face="Verdana"
size="1">
Mute</font></td>
<td height="22" width="75" align="center"><font face="Verdana"
size="1">
UnMute</font></td>
<td height="22" width="66" align="center"><font face="Verdana"
size="1">
Vol Up</font></td>
<td height="22" width="72" align="center"><font face="Verdana"
size="1">
Vol Down</font></td>
</tr>
</table>
---------------------------------------------------------------------------------


I have 2 problems.

1. I want the status of WMP e.g. Buffering etc to appear in a text box
rather than an alert box. When the button is clicked ive tried all
sorts for last few days but i cant seem to figure it out and ive asked
plenty of other places too.

2. It wont work in Firefox at all the image controls. Will i have to
write WMP as javascript document.write?

Any help appreciated.

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top