-->

Streaming Media Metafiles

Article Featured Image

Notice that I can add comments to the file by preceding them with a pound sign (#). The player ignores these. Additional instructions for the RealPlayer can be added on to the URL, like this:

# This is a more complex sample .RAM file
rtsp://myserver.com/myvideofile.rm?start=00:05:00&end=00:08:00&title=My video title&screensize=double

The command set for RealPlayer .RAM files is documented in the RealNetworks Production Guide. There you’ll find the commands for everything from controlling the color of the playback window to loading web pages into the "Related Info" pane of the RealPlayer.

There’s a trick for making a .RAM file that will serve different content to different versions of RealPlayer. Remember those comment lines that RealPlayer ignores? Well, there’s a special case in which RealONE will not ignore them. Here’s an example:

# The following video will play for RealOne Player and later
## .RAM_V3.0_START
## rtsp://myserver.com/myvideofile.rm
## .RAM_V3.0_END
# The following video will play for RealPlayer G2 through RealPlayer 10
rtsp://myserver.com/myothervideofile.rm

Everything between the lines with "## .RAM_V3.0_START" and "## .RAM_V3.0_END" will only be seen by the RealONE player or later. Earlier versions will see these lines as comments and skip over them.

Ramgen
Now, if you’re not using version detection or issuing special commands, then the thought of making .RAM files for each and every video you link to may seem like a huge hassle. But there’s a way out. Since these metafiles are just text, then they can be generated on the fly using scripts, Common Gateway Interface, JavaServer Pages, or any of the other techniques used for generating dynamic web content. Even better, all versions of RealServer and Helix server have a built-in utility for doing this. It’s called "ramgen," and you call it from your web page like this:

http://myserver.com:8080/ramgen/myvideofile.rm

The ":8080" in the server part of the URL must match the port number that the server is configured to listen to for HTTP connections. "8080" is the default, but it can be changed by the server administrator. Then we call the /ramgen/ script, which will generate a one-line .RAM file that points to the video file referenced at the end of the URL. You can use these ramgen links in your web pages instead of linking to separate .RAM files for each media file on your server. More information on ramgen can be found in the RealNetworks Production Guide.

Windows .ASX Metafiles
Like .RAM files for RealPlayer, .ASX files tell the Windows Media player how to connect to the server to get the media file being requested. This means that at minimum, it needs to contain a URL that points to the server and file that the user wants to play. A basic .ASX file looks like this:

Streaming Covers
Free
for qualified subscribers
Subscribe Now Current Issue Past Issues