Programatically control wmp using javascript?

S

shotokan99

on my page, i embedded wmp this way:

<object id="mplayer" codebase=http://activex.microsoft.com/activex/
con...
type=application/x-oleobject align=absmiddle
classid=CLSID:22d6f312-b0f6-11...
<param name="FileName" value="../Madagascar.avi" >
<param name="ShowControls" value="0">
<param name="ShowStatusBar" value="0">
<param name="ShowDisplay" value="0">
<param name="DefaultFrame" value="Slide">
<param name="PlayCount" value="1">
<param name="Autostart" value="-1">
<embed src="../Madagascar.avi" width=350 height=220 autostart=1 loop=0
align="absmiddle" type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/windows/mediapl...
showcontrols=0 showdisplay=0 showstatusbar=0 > </embed></object>

now i wanted to control it programaticaly using javascript..i tried 2
options and both didnt work:
-getElementById('mplayer').con... and
getElementById('mplayer').stop...

btw, my browser is firefox.

tnx
 
S

Stevo

shotokan99 said:
now i wanted to control it programaticaly using javascript..i tried 2
options and both didnt work:
-getElementById('mplayer').con... and
getElementById('mplayer').stop...

I've found that using getElementById isn't good for scripting into
Flash, I wonder if that also applies to WMP. You can try the solution
anyway if you like:

var obj = WINDOWS_IE ? window['mplayer'] : document['mplayer'];
if(obj)
obj.something();

I didn't make this up, it was documented on a few sites as the best way
to get a handle to a Flash object for scripting. I can only assume it
applies to other object/embeds.

It looks to me like using getElementById should be getting the same
thing, so this shouldn't make sense, but it was given as a workaround
and it did work. Someone here can probably explain why it works.
 
S

shotokan99

i was able to solve this by installing new ff wmp plugin. then change
my object declaration, this time a bit compact:
<object id="mplayer" type="application/x-ms-wmp"
data="Madagascar.avi" width=350 height=220>
<param name="URL" value="Madagascar.avi" />
<param name="Autostart" value="1">
<param name="uiMode" value="none" />
</object>

this mplayer.controls.play()...etc works fine. my next question is,how
can i manipulate the playlist programatically? in case it has a
playlist...
 

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,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top