MP9 stream, Javascipt and form buttons
WMPTalk.com Forum Index WMPTalk.com
Discuss Windows Media Player
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web wmptalk.com
MP9 stream, Javascipt and form buttons

 
Post new topic   Reply to topic    WMPTalk.com Forum Index -> Windows Media on Web
Author Message
Trammel
Guest





Posted: Sat May 29, 2004 8:49 am    Post subject: MP9 stream, Javascipt and form buttons Reply with quote

I've been trying to get a hidden MediaPlayer 9 window to play a stream from
a webpage...
So far I have managed to embed a hidden MP9 for both Netscape & IE

My problem lies with the javascript to control MP9, it doesn't work - lol
Buttons on my page use on onClick event to call a javascript function.

The functions do "mediaPlayer.stop()" and the MP9 object is named
mediaPlayer
I have tried the following:
* mediaPlayer.stop()
* mediaPlayer.controls.stop()
* document.mediaPlayer.stop()
* document.mediaPlayer.controls.stop()

None seem to work and the MSDN, etc dont seem to be of any help as they
suggest this too.
Anyone got working play/stop buttons using onClick events or did MS drop
support for that in MP9 ? :(



Here's my code so far (test.html) :

<HTML>
<HEAD>
<TITLE>Doc JavaScript's Streaming Media JukeBox</TITLE>
<SCRIPT LANGUAGE = "JavaScript">
var streams = new Array();
streams[0] = new
makeStream("http://www.energydanceradio.com/jamz/wmmedia.asx", "R&B");
streams[1] = new
makeStream("http://www.ministryofsound.com/asx/radio/mosradio.asx",
"Ministry of sound");
streams[2] = new makeStream("http://www.bnetradio.com/asx/bnet-hs.asx",
"Classic rock");

function makeStream(url, name) {
this.url = url;
this.name = name;
}

function change() {
var list = document.playerCtrl.streams;
var streamURL = list.options[list.selectedIndex].value;
document.mediaPlayer.stop();
document.playerCtrl.playOrPause.value = " Pause ";
document.mediaPlayer.fileName = streamURL;
}

function stop() {
document.mediaPlayer.stop();
}

function play() {
document.mediaPlayer.play();
}

</SCRIPT>
</HEAD>
<BODY LEFTMARGIN = "100">
<h3>Trammel's Streaming Media Experiment</h3><P><P><HR><P>
<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="http://www.energydanceradio.com/jamz/wmmedia.asx">
<PARAM NAME="animationatStart" VALUE="true">
<PARAM NAME="transparentatStart" VALUE="true">
<PARAM NAME="autoStart" VALUE="true">
<PARAM NAME="showControls" VALUE="false">
</OBJECT><P>

<FORM NAME="playerCtrl">
<INPUT TYPE="button" VALUE="stop" NAME="stop" onclick="stop()">
<INPUT TYPE="button" VALUE="play" NAME="play" onclick="play()"><br>
<SCRIPT LANGUAGE="JavaScript">
with (document) {
writeln('<SELECT NAME="streams" onChange="change()">');
for (var i = 0; i < streams.length; i++) {
writeln('<OPTION VALUE="', streams[i].url, '">', streams[i].name);
}
writeln('</SELECT>');
}
</SCRIPT>
</FORM>
</BODY>
</HTML>

Back to top
 
Post new topic   Reply to topic    WMPTalk.com Forum Index -> Windows Media on Web All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Microsoft Office Forum New Topics
Powered by phpBB