Hack 91. Watch Videos Within Firefox
Use mplayerplug-in to view video embedded into web pages.
If you chat with a group of geeks for any extended period of time, the conversation inevitably steers into talks of the "good old days" of computing, when geeks were geeks and you edited your files with a magnet and a magnifying glass. Let me be the first to break rank and say that the good old days of watching embedded web video under Linux were anything but. In the case of QuickTime video (such as movie trailers), once Linux was able to play them, you still couldn't watch them in a browser: instead you had to put on your detective hat and often dig around in the web page source for the URL you needed to download the video. That of course was only if you could find the right URL.
MPlayer's support of streaming URLs from the command line improved things a bit, but considering the steps Windows users had to take to watch video streams on the Web, it was still pretty troublesome. A breakthrough came with the creation of the mplayerplug-ina plug-in for Mozilla-based browsers (Konqueror is not currently supported) that embedded MPlayer into web pages offering streaming video. Now every video that MPlayer can play outside of the browser you can play embedded inside the browser so the experience is more or less the same as browsing under Windows.
Since mplayerplug-in uses MPlayer for all the video playback, you will need MPlayer version 0.92 or higher installed on your system. ([Hack #48] explains how to install and use MPlayer.)
The downloads page for mplayerplug-in at http://mplayerplug-in.sourceforge.net offers links to precompiled packages for a number of Linux distributions, so installation is simple: download the package that matches your distribution and install it using your distribution's package manager. If you use a Debian-based distribution, the package is called mozilla-mplayer and is a part of the Debian "unstable contrib" repository. Add the following line to your /etc/apt/sources.list, run apt-get update, and then install the package:
deb ftp://ftp.nerim.net/debian-marillat/ unstable main
If there isn't a package for your particular distribution, just download the source code from the project page and follow the installation instructions at http://mplayerplug-in.sourceforge.net/install.php to compile and install the software.
After the software is installed, open Firefox or another Mozilla-based browser and browse to your favorite movie-trailer site. When you open a page that has embedded video, mplayerplug-in should display in the video's space. By default mplayerplug-in caches 25% of the video before it plays, and it shows the current cache status as it is downloading. When the cache limit of 25% is reached the video begins. You can control playback with the buttons along the bottom of the interface. There is also a button to the far right of the controls that will toggle full-screen mode for the video.
mplayerplug-in chooses sane defaults, but it also provides a number of options for you to tweak. Configuration tweaks that affect all users can be done in /etc/mplayerplug-in.conf. Or you can put a configuration that just affects your user in ~/.mplayer/mplayerplug-in.conf. This file contains all mplayerplug-in options, set to their defaults and commented out. This way you can see your options and their normal behaviors. The mplayerplug-in documentation at http://mplayerplug-in.sourceforge.net/config.php describes the purposes of all the options, but a few bear mentioning here. Table 5-1 lists a number of interesting mplayerplug-in options and their functions.