473,836 Members | 1,935 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 21483

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
2292
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. Is there a way to stack two players on top of each other using the z-index with plugins?
1
8922
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 libraries created by Visual
1
7899
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 player SDK which come with some IDL and
3
5196
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? TIA - Jeff.
1
5555
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
3822
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 both IE 6 and Firefox. I've had to concentrate on adding new features to the IE side and am now...
0
2673
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 out needing a user logged in on the computer. Also it would allow the music-on-hold to work if we...
1
2148
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 seem to work, what I think it is the problem, that windows media player doesn't seem to use the...
1
11635
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 working in IE but I can't get it to work in Firefox. Problems: 1. The buttons (image buttons)...
0
9812
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9658
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10824
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10533
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9362
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5644
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4443
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
2
4003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3103
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.