Hello
I am trying to get an embeded WMP player to support ScriptCommand on a MAC.
I have tested under Safari as well as FireFox and IE, and can't seem to get
this to work. Has anyone out there been able to get ScriptCommands (URL
Specifically) to work under a MAC. If so please reply.
Here are the details of my implementation approach.
From what I understand, one has to use the embeded player to get browsers
under MAC to load the WMP plugin. No problems there, I can get media to play.
However the embeded WMP does not seem to handle the URL script commands. I
suspect this is because it is using the mplayer2 plugin instead of the
activeX plugin control (i can even see that the browser see's the URL,
however dosen't know what to do with it).
I have attempted using the Mozilla ActiveX plugin, however though this works
perfectly under WIN32, the plugin never loads under MAC OS X 10.3.? Is this
normal ?
So this brought me to trying to use the plugin handler as suggested by
support articles relating to cross compatibility
(NPDS.npDSEvtObsProxy.class). Though I can get the apps to load (I can see
this at the java console), I can't get the applet to initialise properly when
calling the "loader()" function (see code below). I keep getting an error
message at the javascript console stating that the
"setByProxyDSScriptCommandObserver" is not a function.
Has anyone been able to use this plugin anymore ?
Here is the relevant sections of code if anyone can help me.
I call the loader() function off a body tag (onload="loader()").
Javascript console in Mozilla 1.0 tells me :
Error: document.appObs.setByProxyDSScriptCommandObserver is not a function
<object id="NSPlay" width=320 height=46
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
standby="Loading Microsoft Media Player components..."
type="application/x-oleobject" align="bottom">
<param name="Filename" value="asx.asp?parser=<%=ThePage%>">
<param name="AutoStart" value="True">
<param name="ShowControls" value="True">
<param name="ShowStatusBar" value="False">
<param name="ShowDisplay" value="False">
<param name="AutoRewind" value="True">
<embed type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
width="320" height="46" src="asx.asp?parser=<%=ThePage%>"
autostart="True" showcontrols="True" showstatusbar="False"
showdisplay="False" autorewind="True"
name="NSPlay">
</embed>
</object>
<script language="JavaScript">
<!--
if ( navigator.appName == "Netscape" )
{
navigator.plugins.refresh();
document.write("\x3C" + "applet MAYSCRIPT
Code=NPDS.npDSEvtObsProxy.class codebase=http://cool.mcgill.ca/test/" )
document.writeln(" width=5 height=5 name=appObs\x3E \x3C/applet\x3E")
}
-->
function OnDSScriptCommandEvt (bstrType, bstrParam){
alert("SEEING SCRIPT Commands");
}
function loader(){
if ( navigator.appName == "Netscape" ) {
var plugIn = document.NSPlay;
document.appObs.setByProxyDSScriptCommandObserver(plugIn, true);
}
}
</script>
Thanks for any information.
Sincerely
Nic Siggel
Corentin Cras-Méneur - 20 Dec 2004 21:31 GMT
Hi,
> Hello
> I am trying to get an embeded WMP player to support ScriptCommand on a MAC.
> I have tested under Safari as well as FireFox and IE, and can't seem to get
> this to work. Has anyone out there been able to get ScriptCommands (URL
> Specifically) to work under a MAC. If so please reply.
I can see in the code that you are using OLE-objects..... As far as I
know, that's a big no-no for WMP for Mac unfortunately :-\ (I'd love to
be wrong though)
Corentin

Signature
--- Mac:MS MVP (Francophone) ---
http://www.mvps.org - http://mvp.support.microsoft.com
MVPs are not MS employees - Les MVP ne travaillent pas pour MS
Remove "NoSpam" to e-mail me - Retirez "NoSpam" pour m'écrire
Preeti - 21 Dec 2005 19:47 GMT
Hi NSiggel,
I am having the same kind of problem in Windows Firefox and Mac Safari - not
being able to capture the WMP events like PlayStateChange(), positionChange()
etc. I am able to do the same in Windows IE.
I noticed you said 'I have attempted using the Mozilla ActiveX plugin,
however though this works perfectly under WIN32'. Were you able to capture
the WMP events in Firefox...if so, which version of FF?
Here is the code that works in Windows IE but not in Windows FF:
<html>
<body>
<script language="JavaScript" for="MediaPlayer"
event="Buffering(currentlyBuffering)">alert("Bufferring is " +
currentlyBuffering);</script>
<script language="JavaScript" for="MediaPlayer"
event="positionChange(oldPosition, newPosition)">alert("oldposition is " +
oldPosition + " and new position is " + newPosition);</script>
<script language="JavaScript" for="MediaPlayer"
event="PlayStateChange(newState)">alert("playstate change with new state " +
newState );</script>
<script language="JavaScript" for="MediaPlayer"
event="OpenStateChange(newState)">alert("OpenStateChange with new state " +
newState );</script>
<OBJECT ID="MediaPlayer"
CLASSID=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6
standby="Loading Microsoft Windows Media Player components..."
TYPE="application/x-oleobject"
width="320"
height="313">
<param name="URL" value="MyVideoFile.asx">
<param name="uiMode" value="full">
</OBJECT>
</body>
</html>
Any help on this is really appreciated.
Thanks,
Preeti
> Hello
> I am trying to get an embeded WMP player to support ScriptCommand on a MAC.
[quoted text clipped - 72 lines]
> Sincerely
> Nic Siggel
Sebastian Gottschalk - 21 Dec 2005 20:45 GMT
There are many, many errors.
1. Your Object tag ist totally defective. The correct way would be:
<OBJECT ID="MediaPlayer" CLASSID="WMPlayer.WMPlayer"
TYPE="video/x-ms-wmv" data="MyVideoFile.asx" width="320" height="313">If
you can read this, I didn't manage to find a plugin. :-)</OBJECT>
Be aware that ActiveX is disabled by default for very good reason.
Anyway, you original way was also wrong, the correct ClassID can be seen
above - using an Internet Explorer vulnerability to load ActiveX
controls via GUID is a very bad practice.
2. Your next wrong assumption is that the WMP plugin actually get's
loaded, but no other plugin. Very bad for those who're using
VideoLanClient's Mozilla Plugin or alikes.
3. There are no such attributes like "language" or "for". However,
Firefox does interprete the language attribute for compatibility reasons
and skips anything which is not "JavaScript". Still the attribute "type"
with value "text/javascript" is missing, and due to that "for" simply
doesn't exist, of course you need to manually assign events through
DOM's routeEvent() function.
4. The next wrong assumption is that events are actually generated. I
don't know if this is documented in Netscape/Mozilla anywhere.
5. Even worse, you assume that you could actually propagate events from
the plugin to DOM. Only IE's total lack of security could allow this,
sane browsers however either don't implement it at all or require very
strict security checks. Where's your
"netscape.security.PrivilegeManager.enablePrivilege('LiveConnect')"?
6. WMP's Plugin is known to be totally defective regarding the Netscape
Plugin API. The common solution is to embed the NPDS Java Applet,
generate a connection to DOM (security check required!) and the assign
the event handler.
<object data="NPDS.npDSEvtObsProxy.class"
classid="java:NPDS.npDSEvtObsProxy.class" type="application/java"
width="0" height="0" id="foobar"></object>
...
try {
netscape.security.PrivilegeManager.enablePrivilege('LiveConnect');
document.getElementById('foobar').
setByProxyDSScriptCommandObserver(document.getElementById('MediaPlayer'),true);
} catch (Exception e) {
...
}
The code your quoted (why did you requote everything anyway) is pretty
defective.
7. Even further, the default configuration blacklists the WMP plugin for
good reason - allowing to script the WMP plugin is like outselling the
contents of your harddrive to anyone who wants to read them.
You could you simply stop trying to invoke useless features based on
event processing and simply use a plugin as what it's designed to be - a
simple viewer for embedded media objects?