JulioHM wrote:
Hi all,
I'm trying to use WMP in FireFox and I have the following tag to embed
the player into the html page.
<EMBED TYPE="applicati on/x-mplayer2"
PLUGINSPAGE="ht tp://microsoft.com/windows/mediaplayer/en/download/"
ID="wmp"
Name="wmp"
DISPLAYSIZE="4"
AUTOSIZE="-1"
BGCOLOR="darkbl ue"
SHOWCONTROLS="-1"
SHOWTRACKER="-1"
SHOWDISPLAY="0"
SHOWSTATUSBAR="-1"
VIDEOBORDER3D="-1"
WIDTH=320
HEIGHT=313
SRC=""
AUTOSTART="-1"
DESIGNTIMESP="5 311">
</EMBED>
Problem is that I can't access the controls through JavaScript. I have
to change the SRC property and play a new file according to user input.
var w = document.getEle mentById('wmp') ;
// This doesn't work... JavaScript error: "Play is not function"
wmp.Play();
// this also doesn't work... "controls is undefined"
wmp.controls.Pl ay();
Anyone knows how to control WMP via JavaScript? I'm googling all over,
but I can't find a piece of code that shows me how to do it...
I can not be certain exactly what you wish to do without an example on
a web page. The WMP can be used to play audio or video. From the width
and height you use, I am guessing you are allowing room for a video. If
at all possible, avoid trying to control the WMP with script. First,
embed has never been an official tag, and object is the modern method.
Of course many sites still use tag soup with an ActiveX object for IE
and an embed path within the AE object for most other browsers that do
not support AE. You will find the W3C validator does not like this soup
or use of a simple embed tag.
The WMP has many controls built in that can be specified in a correct
object tag, so it usually is not necessary to make your own controls
using script or whatever.
Go to a page of mine at
http://www.cwdjr.info/broadbandMedia.../cancanWMV.php and look
at the object code that inserts the WMP with controls. This video uses
a very high variable bit rate wmv video file, so it may not stream on
dialup without an extremely long buffering time. The average bit rate
is about 1919 kbps. You will notice that the object for the video calls
for a .wvx file which is a redirector file; the actual video file is a
..wmv file. The .wvx file has a simple XML structure that points to the
..wmv file, and the one used in this example is:
<ASX VERSION="3.0">
<ENTRY>
<REF HREF="http://www.cwdjr.info/movie/CanCanvbr.wmv" />
</ENTRY>
</ASX>
On broadband, that will allow about 2.5 Mbps, buffering of the above
sample is quite fast, and you can click on the video shortly when
buffering is completed. For good dialup, you would need a video
recorded at not more than about 30 kbps, and the image would need to be
kept quite small. Even so, streaming video leaves much to be desired on
dialup. My example works on most recent popular browsers with the WMP
installed including IE6, Opera, and the Mozilla family(Firefox,
Mozilla, Netscape).
If you absolutely must use script to control the WMP, there used to be
some information somewhere on the Microsoft developers sites. However,
if I remember correctly, some of the uses of script discussed there
used Microsoft Jscript, some examples were designed to work on ActiveX
objects that often are not supported by non-IE browsers, and some
scripts to detect the WMP and version used vb script that does not work
on many non-IE browsers. One likely could spend days at Microsoft
developer sites finding scripts and testing, and often changing them
for non-IE browsers.