Next Previous Contents

4. Connecting your browser to MPlayer

Most browsers include a mechanism to associate certain file types with plugins or 'helper applications'. We want to associate *.asx files (of mime type video/x-ms-asf) with MPlayer. A trivial task, one would think. Or is it?

4.1 Konqueror

Version 3.0.3

The obvious way appears to be choosing: 'Settings->Configure Konqueror->File Associations'. then, in the 'Known Types' treeview, expand the 'video' branch, click on 'x-ms-asf' (or add it if it's not there). Then, in the 'Application Preference Order' frame, click the 'Add' button, and enter '/usr/local/bin/mplayer' in the combo box. Click 'OK'. Then click the 'Embedding' tab, and check 'Show file in separate viewer'. Click 'Apply', and 'OK'.

Unfortunately, this doesn't work. Why not? It works fine when you feed the URL directly to MPlayer on the shell prompt, like this:

gmplayer http://www.dsltv.nl/asx/ngc.asx

It's because Konqueror saves the .asx file to a temporary file on the local filesystem, and feeds that to MPlayer. Unfortunately, once it's on the local filesystem, MPlayer no longer recognizes it as an ASX playlist file, and issues an error message.

We must explicitly tell MPlayer that it is an ASX playlist file, by giving it the '-playlist' switch:

And viola, it works!

You might notice two entries for 'x-ms-asf' in the 'Known Types' treeview. The other one is for *.asf files, for which MPlayer needs to be invoked without the '-playlist' switch, because ASF is not a playlist file, but an actual stream.

4.2 Mozilla

Version 1.1

The same trick must be applied with Mozilla. Unfortunately, it now doesn't work! Why not? Because Mozilla appears to be executing 'gmplayer -playlist' (that is: a program called 'gmplayer -playlist', instead of a program called 'gmplayer' with '-playlist' as the first argument). This can be remedied by using a small shell script as a front-end to MPlayer:

#!/bin/bash
gmplayer -playlist "$*"

Save this file as, let's say, /usr/local/bin/run-gmplayer, and make it executable with:

chmod +x /usr/local/bin/run-gmplayer

Now fire up Mozilla, go to 'Edit->Preferences', and click the 'Helper Applications' item in the 'Category' treeview. Click the 'New Type...' button. Fill out the fields like this:

Click 'OK' twice, and you're done!

Unfortunately, in Mozilla, you can't add a second helper for the same mime-type, like you can in Konqueror, so now your ASF support is broken (like it already was before you started, so no big loss here :-)). Any self-respecting site that offers ASF streaming should use ASX playlist files anyway.

4.3 Other browsers

The shell script approach should work with any browser that allows you to tie helper applications to file/mime types.


Next Previous Contents