473,549 Members | 2,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FireFox and Windows Media Player

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...

Thanks in advance!

Jun 2 '06 #1
5 21465

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.

Jun 3 '06 #2
Thanks for the reply, and sorry for the lack of more info.

Well, I'm trying to use WMP to play sound files. The size of the
embeded object would be reduced to show only the player controls. But
that's not really the important thing on my problem.

I have the need to use JavaScritp to control the player (that's the
issue), because the contents of the player (the file which must be
played) vary according to where the use clicks on the webpage.

I'm starting to guess there is no way around that... since it's a
micro$oft product... maybe the only way to control it via scripting is
inside IE.

But thanks anyway. I'll keep waiting for any good soul who knows the
answer :)

Thanks!

cwdjrxyz escreveu:
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.


Jun 20 '06 #3

JulioHM wrote:
Thanks for the reply, and sorry for the lack of more info.

Well, I'm trying to use WMP to play sound files. The size of the
embeded object would be reduced to show only the player controls. But
that's not really the important thing on my problem.

I have the need to use JavaScritp to control the player (that's the
issue), because the contents of the player (the file which must be
played) vary according to where the use clicks on the webpage.

I'm starting to guess there is no way around that... since it's a
micro$oft product... maybe the only way to control it via scripting is
inside IE.


Since you need several audio links, you can write a mini player for
each link and place it on the desired part of the page using absolute
positioning. See http://www.cwdjr.info/media/playersRoot.php and select
the WMP(SCRIPT) link at the top of the page for an example. I used php
on the server to write the long division containing all of the players
using the php equivalent of document.write for a loop that positions
all of the players down the left side of the page by a fixed increment
for each player. This saved me a lot of work. However you could just as
well write any set of positions you desire by hand. This could place
the tiny mini players, each with only a start/stop button all over the
page as desired. This may not be exactly what you seem to want, because
the buttons will show. However it may give you some ideas. Although my
example page is long, about all you need to consider in it is the
division that writes all of the players.

Jun 20 '06 #4
Thanks.. but still.. I need to script code to start the player with an
user action (eg: onClick). I haven't been able to find the JavaScript
code to do that.

wmp.Play() just won't do it.

cwdjrxyz wrote:
JulioHM wrote:
Thanks for the reply, and sorry for the lack of more info.

Well, I'm trying to use WMP to play sound files. The size of the
embeded object would be reduced to show only the player controls. But
that's not really the important thing on my problem.

I have the need to use JavaScritp to control the player (that's the
issue), because the contents of the player (the file which must be
played) vary according to where the use clicks on the webpage.

I'm starting to guess there is no way around that... since it's a
micro$oft product... maybe the only way to control it via scripting is
inside IE.


Since you need several audio links, you can write a mini player for
each link and place it on the desired part of the page using absolute
positioning. See http://www.cwdjr.info/media/playersRoot.php and select
the WMP(SCRIPT) link at the top of the page for an example. I used php
on the server to write the long division containing all of the players
using the php equivalent of document.write for a loop that positions
all of the players down the left side of the page by a fixed increment
for each player. This saved me a lot of work. However you could just as
well write any set of positions you desire by hand. This could place
the tiny mini players, each with only a start/stop button all over the
page as desired. This may not be exactly what you seem to want, because
the buttons will show. However it may give you some ideas. Although my
example page is long, about all you need to consider in it is the
division that writes all of the players.


Jun 20 '06 #5

JulioHM wrote:
Thanks.. but still.. I need to script code to start the player with an
user action (eg: onClick). I haven't been able to find the JavaScript
code to do that.


I must be missing something here. If you place the multiple mini
players at points on the page where needed as I suggested, then a click
on their buttons will start or stop the player for that area. You gave
a desired user action example as on Click and that is what the player
buttons do!. Perhaps you had an on mouseover in mind. For example, when
you move the cursor to anywhere over a defined area of the page, a
sound for that area starts playing. This can be fairly easily scripted
for IE where you use an ActiveX object for the player. Unfortunately
this method fails for most other browsers that do not support an
ActiveX object for the WMP. Many of the WMP script controls that you
find at Microsoft work only for an ActiveX WMP object. I could post a
link to an old mouseover effect that plays sound on IE only, but I
hesitate to do anything else unless I understand better exactly what
you are after. Not having a page you wrote as a starting point makes
this rather difficult.

Jun 21 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2279
by: torbs | last post by:
Hi I have two quicktime plugins embedded in a webpage. I want to hide one and display the other. Then I want to load a movie into the hidden player. When the first player is finished playing, I hide it, and show the hidden player. In IE I do this by setting the z-index of the quicktime objects. This however do not work in other browsers....
1
8900
by: Anise | last post by:
I have a question concerning embedding a windows media player into a web application in .net.. I download Windows Media Player 10 and its SDK On the .ascx page I placed a windows media player object from the toolbox and all the sites i read say when "Adding the Windows Media Player control from the Toolbox also adds references to two...
1
7873
by: Stephen Adam | last post by:
Hi there, Have spent a while trying to find out how to connect to Windows Media Player through COM. Unfortunately there doesnt seem to be much stuff about it on the web. What I need to do is create a simple console application which will be able to find out what the values of a currently playing tack. I've downloaded the Windows Media...
3
5178
by: UJ | last post by:
I have a .avi file that uses the Divx codec. If I load it with windows media player program it works fine. If I load it using my control in a program, it doesn't display. Over standard media files work fine so it's this particular file. Do I have to do anything when the file uses a non-included codec? How can I tell what Codec it's using? ...
1
5523
by: sri2097 | last post by:
Basically, I want to check if a URL is playable or not (without actually playing it). i.e. given a URL I want to write an automation script to figure it out for me if it's playable or not. If you give a bad/invalid URL for windows media player to play a pop-up window shows us that it cannot be played. So I would want to catch that event.
9
3800
by: johnd126 | last post by:
I have a cgi program which outputs a fairly hefty amount of html/javascript for doing a complex slide show sorta thing in a variety of areas in the browser. I accomplish this by creating a series of iframes and populating each iframe which its own copy of the code and a list of items to display. It previously had it working tickety-boo with...
0
2655
by: artsohc | last post by:
Hey Everyone, this is my first time posting so go easy on me. I am trying to hook up music-on-hold at the office I work at. I got all the music loaded and I got Windows Media Player working while the phones are on hold, but now I am trying to write a script that will allow Windows Media Player to run as a service so I can make it auto-start with...
1
2126
by: xhunter | last post by:
I am streaming some files on my site (progressive http streaming), I use php to authenticate logged in users with sessions and cookies, and then send the stream to be opened. All my Quicktime and Real players files are working absolutely fine in all browsers, but the problem is, when it comes to Windows Media Player and Firefox, it doesn't...
1
11615
by: SeanBoyWalton | last post by:
Hi, I'm currently trying to build a website for a DJ friend of mine and I have come stuck with a couple of issues. I've searched everywhere and put some code together but I still have problems. I want to be able to map controls of the media player to images on the page ie - when user clicks play image - song plays. I can currently get it...
0
7554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7511
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7840
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6088
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5396
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5119
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1973
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.