473,397 Members | 2,077 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,397 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 2643

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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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,...
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...
0
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...
0
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...
0
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...

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.