473,386 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Stopping/starting WMA

I'm using Windows Media Audio, via a WAX file, and I have some custom
controls to start and stop the audio. While it works in IE, FF gives an
error. The HTML looks like this:

<object id='obj' type='audio/x-ms-wax'
style='position:absolute; left:0px; top:0px;'
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codeBase='http://activex... blah
width='100' height='100'>
<param name='FileName' value='wma_sample.wax'>
<param name='AutoStart' value='0'>

<embed id='objff' type='audio/x-ms-wax'
src='wma_sample.wax' autostart='0' width='100' height='100'></embed>
</object>

and the relevant FF JavaScript look like this:

if (typeof document.getElementById('objff').Play != "undefined") {
document.getElementById('objff').Play();
} else {
alert("An error occurred and the audio could not be played.");
}
If I change the type and the sample to an MP3 file then the custom
controls work in FF. Is there a way to get FF to control WMA?

Andrew Poulos
Aug 3 '06 #1
6 2642

Andrew Poulos wrote:
I'm using Windows Media Audio, via a WAX file, and I have some custom
controls to start and stop the audio. While it works in IE, FF gives an
error. The HTML looks like this:

<object id='obj' type='audio/x-ms-wax'
style='position:absolute; left:0px; top:0px;'
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codeBase='http://activex... blah
width='100' height='100'>
<param name='FileName' value='wma_sample.wax'>
<param name='AutoStart' value='0'>

<embed id='objff' type='audio/x-ms-wax'
src='wma_sample.wax' autostart='0' width='100' height='100'></embed>
</object>
The above code usually works, but you will find many validation errors
if you check it at the W3C validator. Briefly, this code uses an
ActiveX object for browsers that support it(mainly IE). The ActiveX
path is valid code for browsers that support it. For the many browsers
that do not support ActiveX for the WMP, the embed path is
automatically taken. This usually works, but embed is a hangover from
the browser war era and has never been part of official W3C html. Hence
the validation errors you will get. However this can all be avoided.

See http://www.cwdjr.info/souearly/mixedtestRoot.php and view the
source code. This code will work for the WMP using a .wax
redirector/playlist file, and the wax file can include several songs in
wma, mpg, wav, midi etc formats that will play in sequence. The WMP is
a huge program, about 3 to 4 times the size of many lean browsers such
as Firefox. It has many controls built in, so why reinvent the wheel?
You can have anything from a simple on/off button with auto start or
not, up to much more elaborate controls such as on my demo page.
Controlling the WMP with custom written script can be very tricky and
has varied some with WMP updates. There used to be quite a bit about
this subject on the vast Microsoft developers sites. However you will
find that many of the controls they use are aimed at IE only. Some use
vbscript that most browsers do not support. Some use Microsoft's
Jscript. I used to write scripts to control the WMP, but I now would do
it only as a last resort. For example, one of the Microsoft scripts
used to detect the WMP version failed after an upgrade, and I had to go
in and revise the Jscript and a vbscript - and all of this just to play
correctly on IE.

In addition to the code I show on my page, it is also possible to use
Microsoft conditional html comments to use an ActiveX path for IE and
an object path for everything else. This might be of limited use if one
wanted to use a parameter on IE that is only supported by an ActiveX
control and do something else for other browsers. I also have code for
this, but it is unlikely to be needed for your application.

Aug 3 '06 #2
cwdjrxyz wrote:
Andrew Poulos wrote:
>I'm using Windows Media Audio, via a WAX file, and I have some custom
controls to start and stop the audio. While it works in IE, FF gives an
error. The HTML looks like this:

<object id='obj' type='audio/x-ms-wax'
style='position:absolute; left:0px; top:0px;'
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codeBase='http://activex... blah
width='100' height='100'>
<param name='FileName' value='wma_sample.wax'>
<param name='AutoStart' value='0'>

<embed id='objff' type='audio/x-ms-wax'
src='wma_sample.wax' autostart='0' width='100' height='100'></embed>
</object>

The above code usually works, but you will find many validation errors
if you check it at the W3C validator. Briefly, this code uses an
ActiveX object for browsers that support it(mainly IE). The ActiveX
path is valid code for browsers that support it. For the many browsers
that do not support ActiveX for the WMP, the embed path is
automatically taken. This usually works, but embed is a hangover from
the browser war era and has never been part of official W3C html. Hence
the validation errors you will get. However this can all be avoided.

See http://www.cwdjr.info/souearly/mixedtestRoot.php and view the
source code. This code will work for the WMP using a .wax
[snip]

Thanks for the code but my problem is not playing WMA/WAX files in
Firefox it's starting and stopping them using JavaScript.

Andrew Poulos
Aug 3 '06 #3

Andrew Poulos wrote:
Thanks for the code but my problem is not playing WMA/WAX files in
Firefox it's starting and stopping them using JavaScript.
Sorry, but I do not exactly know what you mean. It would help if you
gave a working page so that people could see exactly what is going on
and exactly what you need to do. The built in controls in the WMP
object as I illustrated will of course allow you to start or stop the
WMP at will by clicking the player button. This works for IE6 and
recent versions of Firefox, Opera, Netscape, and Mozilla browsers. Your
answer leads me to think that you may wish to start or stop
automatically upon some event happening rather than by clicking a
start/stop button, but without a working code, I can not be sure.

Aug 3 '06 #4
cwdjrxyz wrote:
Andrew Poulos wrote:
>Thanks for the code but my problem is not playing WMA/WAX files in
Firefox it's starting and stopping them using JavaScript.

Sorry, but I do not exactly know what you mean. It would help if you
gave a working page so that people could see exactly what is going on
and exactly what you need to do. The built in controls in the WMP
object as I illustrated will of course allow you to start or stop the
WMP at will by clicking the player button. This works for IE6 and
recent versions of Firefox, Opera, Netscape, and Mozilla browsers. Your
answer leads me to think that you may wish to start or stop
automatically upon some event happening rather than by clicking a
start/stop button, but without a working code, I cannot be sure.
There's nothing wrong, as such, with your code. It's just that I don't
want to have the standard WMP controls visible. There's a minimal custom
interface that's to use JavaScript to control the playback.

Andrew Poulos
Aug 3 '06 #5

Andrew Poulos wrote:
cwdjrxyz wrote:
Andrew Poulos wrote:
Thanks for the code but my problem is not playing WMA/WAX files in
Firefox it's starting and stopping them using JavaScript.
Sorry, but I do not exactly know what you mean. It would help if you
gave a working page so that people could see exactly what is going on
and exactly what you need to do. The built in controls in the WMP
object as I illustrated will of course allow you to start or stop the
WMP at will by clicking the player button. This works for IE6 and
recent versions of Firefox, Opera, Netscape, and Mozilla browsers. Your
answer leads me to think that you may wish to start or stop
automatically upon some event happening rather than by clicking a
start/stop button, but without a working code, I cannot be sure.

There's nothing wrong, as such, with your code. It's just that I don't
want to have the standard WMP controls visible. There's a minimal custom
interface that's to use JavaScript to control the playback.
I am still not certain I understand exactly what you are wishing to do
without a working example. Since you mentioned a minimal interface, I
just wanted to show you an example of the minimal standard WMP built in
control that is reduced to a start/stop button. See
http://www.cwdjr.info/dhtml/7veilsDance.html . Scroll to the bottom of
the source code to see the player object code. As you will see from all
of the dhtml on the page, I am not adverse to using script in general.
It is just that I avoid it for the WMP when possible for reasons
mentioned in my first post. There have been many posts here and in the
alt.html group over the years concerning problems on some browsers
using script to control the WMP. If you are content with controlling
only on IE browsers, there often is a solution. For other browsers,
there often are complications, as you found in your case. Hopefully
someone else will come along with more information for you. If you
provide a working page example using your code that works on IE and the
code that does not work on Firefox, you are much more likely to get
more responses

Aug 3 '06 #6
cwdjrxyz wrote:
>There's nothing wrong, as such, with your code. It's just that I don't
want to have the standard WMP controls visible. There's a minimal custom
interface that's to use JavaScript to control the playback.

I am still not certain I understand exactly what you are wishing to do
without a working example. Since you mentioned a minimal interface, I
just wanted to show you an example of the minimal standard WMP built in
control that is reduced to a start/stop button. See
http://www.cwdjr.info/dhtml/7veilsDance.html .
I'm not sure I can explain it much simpler.

- I do *not* want the WMP interface visible at all.
- I want to be able to call a JavaScript function that plays the WMA/WAX.
- I want to be able to call another JavaScript function that stops the
WMA/WAX.

Andrew Poulos
Aug 3 '06 #7

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

Similar topics

5
by: CG | last post by:
Hi I have developed a Windows Service When I try to start the Service it tells me that it cannot start as there may not be any work to do When I comment out below line of code in my OnStart...
1
by: Perre Van Wilrijk | last post by:
Hi, I've got a full text index which works fine, SQLSERVER2000/WIN 2000 SERVER. The system requires to update indexes immediately, so I use a timestamp field to enable this. No problems so...
4
by: Keith | last post by:
I'm in the same boat as the fellow who posted this message back in August: Title : Windows Service, How does one make a service "fail" properly? Author : Ross Bennett Group :...
4
by: MSDousti | last post by:
Hi I have written a VB .NET app, which uses several threads. I thought that when the user closes the main window (when MainForm.closed event occures, and I call application.exit) all running...
1
by: juleni | last post by:
Hello, is there a possibility starting or stopping postgres database and creating database instance by JAVA? Is there some API available for this? If yes, can you please write some example, how...
6
by: D | last post by:
I have a simple file server utility that I wish to configure as a Windows service - using the examples of the Python Win32 book, I configured a class for the service, along with the main class...
4
by: bjm | last post by:
I am writing a program that will automate a series of application installations. I want to give the user the option of stopping the program's execution in between installations (for example, give...
3
by: grace | last post by:
dear everyone, we installed a mysql vr standard-4.11.22a-pc on a machine with ubuntu breezy badger as os..after the installation we are trying to start the server by typing :bin/safe_mysqld...but...
0
by: Kruton | last post by:
Hello, Does anyone happen to know if there is a way to programmatically stop and start transactional replication? I would like to have this done without stopping the SQL Server Agent. Thanks,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.