This is a read-only archive!

Playing media files in Firefox in Linux

I've never had luck with media-playing plugins in Linux. I enjoy MediaPlayerConnectivity; it lets you spawn a full-fledged media player of your choice as a separate browser-independent process. Where a media file would normally appear in Firefox, you instead get a big black box and you click on it and up pops your media player. You can also view or copy the URL of the media file using this plugin, which is nice if you feel like wgetting it. An added bonus of this is that you can browse away from a website in Firefox and the media keeps playing. (Another added bonus is that Firefox doesn't crash every 10 minutes from buggy plugins.)

So I have everything set to use /usr/bin/gmplayer, of course; this works wonderfully. But you can also specify different players for different filetypes. It's tempting to use mplayer rather than gmplayer, but this can lead to problems. When you play a media file, mplayer will spawn in the background, and you see nothing until up pops your video. If mplayer chokes or times out or something else untoward happens, you can end up with mplayer processes thrashing in the background and not notice until your fan starts revving up due to 100% CPU utilization. For things like MP3s, you pretty much have to use gmplayer, if you want any kind of ability to stop the song from playing other than pkill -9ing the thing.

Sites like YTMND have MP3s set to play in the background of some pages. MediaPlayerConnectivity can handle those fine. But those MP3s loop. They don't loop if you use MediaPlayerConnectivity; they play once and mplayer closes. So I had the bright idea that I'd set the command for MP3 files in MediaPlayerConnectivity to

/usr/bin/gmplayer -loop 0

This broke the plugin in horrible ways; a bunch of things disappeared from the plugin config menu and the plugin stopped working on any page with MP3s on it. Possibly the plugin chokes on parsing commands with spaces in them. I had to resort to the config "wizard" to get the plugin to work again at all.

So I made a bash script:

#!/bin/bash
mplayer $@ -loop 0

This works.

February 11, 2007 @ 5:55 AM PST
Cateogory: Linux
Tags: Firefox, Linux

2 Comments

numerodix
Quoth numerodix on February 11, 2007 @ 8:18 AM PST

Thanks for the research! You have any testsites?

Brian
Quoth Brian on February 12, 2007 @ 4:06 AM PST

YTMND. :)