Unable to get mouseClicks on RealPlayer

M

MichaelF

I've embedded a RealPlayer window in a page, and am unable to get
mouse clicks. The clip plays, but clicks are ignored.

I'm running IE5.5 on Win2k, with the following code:

<embed name="RPEmbed" src="http://..." CONTROLS=ImageWindow
AUTOSTART=true onLButtonUp="alert('rpm');return false;">

I've also tried setting SetWantMouseEvents(true), but to no avail:

<SCRIPT language="JavaScript">
document.getElementById("RPEmbed").SetWantMouseEvents(true);
</SCRIPT>

What am I missing? Is this even possible?

Thanks.

MichaelF
 
H

Hywel Jenkins

I've embedded a RealPlayer window in a page, and am unable to get
mouse clicks. The clip plays, but clicks are ignored.

I'm running IE5.5 on Win2k, with the following code:

<embed name="RPEmbed" src="http://..." CONTROLS=ImageWindow
AUTOSTART=true onLButtonUp="alert('rpm');return false;">

I've also tried setting SetWantMouseEvents(true), but to no avail:

<SCRIPT language="JavaScript">
document.getElementById("RPEmbed").SetWantMouseEvents(true);
</SCRIPT>

What am I missing? Is this even possible?
Where did you learn about "onLButtonUp" and "SetWantMouseEvents"?
 
M

MichaelF

I got that from the RealPlayer help files on their site. I suspect
it's ActiveX info, although the help files say it's for scripting,
including JavaScript. "RealOne Player Scripting Guide," 15 Oct 2002.
 
M

MichaelF

Tim, thanks for that. You're right about "id" vs. "name."

Looking at the link you posted, it looks to me as if I cannot control
RP in IE if I embed RP via <embed> (only NS). I may be able to do it
if I use <object>, but the doc doesn't explicitly say so. It shows
<object> and controlling via VBScript, but not JavaScript. Is that
how you read it? Have you done this in IE and JavaScript?

Thanks.
 
C

cwdjr

I am not for certain about the RA player, but it is possible with the
Windows Media Player 9 (WMP). The problem is that there are now
several kinds of players that a person may have installed. One person
may play midis and wavs on the WMP, while the next may have the RA
player set up to be primary for these. If you are just writing a page
for your own use, then the problem is not so large. A demo page for
WMP9 which is set up to be primary for midis and wavs is at the URL
http://www.wtv-zone.com/cwdjrsxyz/wmp/zap_wmp_popup2.html . This
embeds the WMP so that it is hidden and does not pop up in your face
and hide the screen every time you play a new selection. When you
examine the code, you will find links to 3 short external scripts, two
JS and 1 VB to do this. It is necessary to detect the presence of the
WMP9 on the viewing browser, write an embedded object if it is found,
and direct to another code for sound if the WMP9 is not found.This
works fine on my Dell with Windows XP and the IE6 browser. I have 4
different media players and 3 browsers installed, so to make such code
work right on all of these combinations is more than I would want to
tackle. The code I use is somewhat of a Frankenstein monster of
techniques I found at Microsoft and various other places on the web.
Sound has become much more complicated on web pages for general
viewing, as we appear to be in the middle of a media player war, and
standards are different for each player.
 
M

MichaelF

Tim, thanks for your patience. I've got a lot of it working, but no
click response. The link you gave helped quite a bit, but in reading
the description of how to get clicks, it doesn't seem at all clear to
me as to how to proceed with JavaScript. I suspect it's not do-able
in IE with JavaScript. It seems to me that it's do-able with NN, or
with IE and VBScript.

For example, the RealMedia doc
(http://service.real.com/help/library/guides/realonescripting/browse/htmfiles/embedint.htm)
samples for callbacks (two of them) are for Netscape only. That
doesn't mean callbacks don't work in JavaScript, but... Also, the doc
has the following example, for VBScript only:
=================
Receiving Callbacks Through VBScript
To receive callbacks through VBScript, you use
the <OBJECT> tag ID, shown here set to RVOCX:

<OBJECT ID=RVOCX HEIGHT=256 WIDTH=256
CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">
<PARAM NAME="controls" VALUE="all">
<PARAM NAME="SRC" VALUE="http://www.example.com/video1.rm">
</OBJECT>

You then use a <SCRIPT> tag to receive a VBScript callback.
The following example shows a callback for OnShowStatus:

<P>Status Text:
<input type="text" name="statusText" size=100><br></P>
<SCRIPT language="VBS">
Sub RVOCX_OnShowStatus(byVal text)
statusText.Value=text
End Sub
</SCRIPT>
===================

That doesn't work in JavaScript (at least as I've translated it, and
using OnLButtonUp):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<SCRIPT language="JavaScript">

function onClk (button_flags, x_pos, y_pos) {
alert ("onClk!!");
}

function OnLButtonUp(flags, x, y){
alert ("OnLButtonUp!!");
}

function WinLoad() {
document.getElementById("RVOCX").SetWantMouseEvents(true);
}
</SCRIPT>

</head>

<body onLoad="WinLoad();" onClick="alert('body click');">

<OBJECT ID=RVOCX HEIGHT=60% WIDTH=60% onClick="alert('click!');"
CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">
<PARAM name="MAINTAINASPECT" value="false">
<PARAM name="AUTOSTART" value="TRUE">
<PARAM name="CONTROLS" value="ImageWindow">
<PARAM NAME="SRC"
VALUE="file://D:\Program
Files\RealPlayer\samples\clips\welcome.rm">
</OBJECT>

</body>
</html>

I get clicks in the body of the page, but not clicks on the RP
control.

Any ideas? Thanks again.

MichaelF
 
M

MichaelF

Update: I emailed a RealMedia customer support person, and they said
this:

I believe you are reading that correctly. By my understanding
Javascript is not supported on IE due to changes in Javascript
imlementation on this browser type.

Here's how I got around that. The doc says you can use VBScript, so
that's what I did. I capture the click in VBScript, and then call a
JavaScript function:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<SCRIPT language="JavaScript">

function onClk (button_flags, x_pos, y_pos) {
alert ("onClk!!");
}

function WinLoad() {
document.getElementById("RVOCX").SetWantMouseEvents(true);
}
</SCRIPT>
<SCRIPT language="VBS">
Sub RVOCX_OnShowStatus(byVal text)
if ("" <> text) then statusText.Value = statusText.Value + "..." +
text
End Sub

Sub RVOCX_OnLButtonUp(byVal flags, byVal x, byVal y)
//alert("click from vbs")
onClk flags, x, y
End Sub
</SCRIPT>

</head>

<body name="BOD" onLoad="WinLoad();" onClick="alert('body click');">

<OBJECT ID=RVOCX HEIGHT=60% WIDTH=60% onClick="alert('click!');"
CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">
<PARAM name="MAINTAINASPECT" value="false">
<PARAM name="AUTOSTART" value="TRUE">
<PARAM name="CONTROLS" value="ImageWindow">
<PARAM NAME="SRC"
VALUE="file://D:\Program
Files\RealPlayer\samples\clips\welcome.rm">
</OBJECT>
<P>Status Text:<input type="text" name="statusText" size=100><br></P>
</body>
</html>
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top