Test for media file playback on MZ (2nd attempt)

A

Andrew Poulos

With a "standard" Mozilla install on Win XP how can I detect whether or
not MZ can play/display a specific media file type, for example WMA and
WMV files?

(Sorry for inadvertantly originally posting this as a reply to Hans'
question.)


Andrew Poulos
 
M

Martin Honnen

Andrew said:
With a "standard" Mozilla install on Win XP how can I detect whether or
not MZ can play/display a specific media file type, for example WMA and
WMV files?

The following checks whether a certain MIME type is registered in
Mozilla to have a plugin:

function checkMimeType (mimeType) {
var mimeTypes = navigator.mimeTypes;
for (var i = 0; i < mimeTypes.length; i++) {
if (mimeTypes.type == mimeType && mimeTypes.enabledPlugin) {
return true;
}
}
return false;
}

then test
if (checkMimeType('audio/x-ms-wma')) {
..
}
 
T

Thomas 'PointedEars' Lahn

Martin said:
Andrew said:
With a "standard" Mozilla install on Win XP how can I detect whether or
not MZ can play/display a specific media file type, for example WMA and
WMV files?

The following checks whether a certain MIME type is registered in
Mozilla to have a plugin:

function checkMimeType (mimeType) {
var mimeTypes = navigator.mimeTypes;
for (var i = 0; i < mimeTypes.length; i++) {
if (mimeTypes.type == mimeType && mimeTypes.enabledPlugin) {
return true;
}
}
return false;
}

then test
if (checkMimeType('audio/x-ms-wma')) {
..
}


However, that does not test if a media file type can be played, it merely
tests whether that type is supported. Its result is misleading, for
example, with Mozilla/Firefox and the mplayer Plug-in if the plug-in is
installed but its configuration file says that support for Windows Media
is disabled.

The only way to make sure that media can be played is to include the object
and a proper alternative, e.g.

<object data="foo.wma">
alternative
</object>

(That would be valid HTML 4.01. There is also the proprietary EMBED
element which supports the same object-alternative-structure.)


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top