Streaming Media Metafiles
Recently, I had a revelation while on a rain-soaked outing with my son’s Boy Scout troop. We were in the midst of the scavenger hunt activity. We’d finally deciphered the first clue and found the "iron man near a bear’s lair." But after sleuthing the clue and hiking through mud and mosquitoes to claim our first prize, it turned out to be a new clue directing us to another (as it turned out, soggy) place. My revelation was that this was a perfect metaphor for streaming media metafiles—links that only point to other links. So here’s an introduction to streaming metafiles, sometimes referred to as "pointer files."
A metafile is really nothing more than a set of instructions for the media player application. In its simplest form, a metafile exists to do two things: It causes the correct streaming media player to launch on the user’s computer, and it tells the player where to go to get the media file it’s supposed to play. A Real .RAM file, a QuickTime reference movie, and a Windows Media .ASX file are all metafiles. When you link to streaming video on your web page, it’s these metafiles that you link to rather than the actual video files themselves. When a user clicks a video link on a web page, the web server responds by sending a content header which contains the mime-type of the requested file. The browser uses the mime-type (rather than filename extensions) to decide which is the correct media player to launch. The content header is followed immediately by the contents of the metafile, which are passed on to the media player. These instructions in the metafile tell the media player how to to open its own connection to the media server to play the video.
Do I Have to Use A Metafile?
Let’s acknowledge this up front—you can put a link to a streaming server directly into your web page like this:
Click me to playvideo
. . . or like this:
. . . but it’s generally a bad idea. Metafiles exist to make sure that the browser knows how to properly hand off the video request to the media player. The techniques above will work, but only sometimes. Using metafiles will increase the odds that everything will work just the way you want it to, for all your visitors.
RealPlayer Metafiles
Metafiles typically contain just a few lines of text. The key ingredient is a URL that the media player uses to make its own connection to the streaming server to get the media file. In the old days of streaming, that’s all a metafile had to do. In these days of complex streaming media applications, metafiles can do much more than that. They can contain playlists, title or copyright information, start and end times, instructions about window size and type, or even multiple media elements with the layout and timing information to make it all play seamlessly. But first we’ll look at some simple examples of basic metafiles for the "big three" formats, starting with RealPlayer.
The most basic metafile for RealPlayer is the .RAM file. At the simplest, a .RAM file has one line with nothing more than a URL, like this:
# This is a sample .RAM file
rtsp://myserver.com/myvideofile.rm