Previous Bytes

Add this site to your favorites!
Did you enjoy reading
Vienna Online?

If you did, you’ll want to
Subscribe Now!

Just enter your name & email
below and click 'Subscribe'.

Name:
Email:




Get IE5.0.
Volume 3 ~ Issue 12 ~ June 2001
Sound Bytes
Advanced RealAudio:
Many means, same ends


The very first Sound Bytes showed us how to use the wizards in RealProducer to create and publish a simple webpage with RealAudio. While these wizards are still available in RealProducer 8, some may want to have greater control over how their RealAudio is linked from their pages.

In this issue we’ll take a look at the different ways in which we can create a link to a RealAudio file, to be played in an external window. (Besides using the RealProducer wizards, that is.)

The most obvious method would be to link directly to the RealAudio file itself.

   <A HREF="music.ra">Listen to music!</A>

The file does not have to be in the same directory, so we can also do this:

   <A HREF="media/music.ra">Listen to music!</A>

This is the simplest method; one only needs to create the RealAudio file, upload it, and link to it. However, it does not afford as much versatility as the others that we’re coming to.

Suppose you want to have a “Song of the Week” that you will change every week. You want to link to this song from several of your pages, but don’t want to go around editing each page every week.

To get around this, you can create a RealMedia Metafile (*.ram). This ram file will serve as a kind of pointer to the actual RealAudio file. You can link to the ram file from all your pages:

   <A HREF="media/SongOfTheWeek.ram">Song of the Week</A>

The ram file is a text file containing just one line, the address of the RealAudio file itself:

   http://www.oocities.org/someone/media/week1.ra

and the following week the link can be changed to:

   http://www.oocities.org/someone/media/week2.ra

Hence all you have to change is the ram file...no need to go through all your pages to update a link. The ram file can be created using your favorite text editor. Simply change the file extension to ‘.ram’ after saving as a text file.

This is effectively the same as what the wizards in the RealProducer program do. If you have access to a RealServer, however, you can make use of RealNetwork’s own rtsp (RealTime Straming Protocol) instead of regular http. If you choose to do so, your ram file should read thus:

   rtsp://www.oocities.org/someone/media/week1.ra

As has been discussed in previous instalments, the rtsp protocol allows the RealServer to select the best way to send your sound clip to the listener. This requires that your RealAudio clip be in SureStream format, though. (See the November 2000 article for more details.)

You could also create a playlist using a ram file, simply by listing the RealAudio files in the order you want them to be played:

   http://www.oocities.org/someone/media/song1.ra
   http://www.oocities.org/someone/media/song2.ra
   http://www.oocities.org/someone/media/song3.ra

Once again, you can use rtsp instead of http if your files are going to be on a RealServer.

And if you cannot really be bothered to create the ram file youself, RealServer offers an utility called “ramgen” that will do the work for you. That is, provided you have access to a RealServer.

Your link should look something like one of the following:

   http://realserver.someserver.com:8080/ramgen/
      media/song.ra?altplay=oldsong.ra

   http://204.71.154.5/ramgen/some/path/sample.smil?embed

and we’ll want to know exactly what all that means:

URL Chunk Meaning
http:// Web browser is to use HTTP to ‘talk to’ the RealServer.
realserver.someserver.com
  or 204.71.154.5
Server address. This may be an IP address, as in the second case.
:8080 Port number that the RealServer uses for HTTP. May be omitted if port 80 is used.
/ramgen/ Invokes ramgen.
/media/   or
   /some/path/
Path of file to be accessed, relative to current path.
song.ra or sample.smil Filename of RealAudio or SMIL file to be linked.
altplay=oldsong.ra Tells ramgen to play oldsong.ra instead if the visitor has an old version of RealPlayer that is not G2 compatible.
?embed Embeds the media file on the page. We will cover this in detail next issue.

You may recall that we dealt with bandwidth issues in the November 2000 issue. One of the bandwidth management techniques mentioned involved the use of a SMIL file to switch between different files for different connection speeds. The above methods will also work for these SMIL files; simply replace the location of the Real Audio (.ra) file with that of the SMIL file. If you are using RealServer, the rtsp protocol and ramgen should also work just fine.

Of course, what I have listed above is by no means exhaustive. I’m sure that there are at least a few more ways to create a link that plays RealAudio in an external window...but they could be really ungainly techniques. These are basically the easiest or most effective ways to do so, and should be sufficient to deal with most needs. And if all fails, there’s always RealProducer. =)

In the next issue, we’ll take a look at the different ways in which you can put embed a RealPlayer in your webpage, allowing visitors to play your media without opening a separate RealPlayer window.


Keith K. Klassiks has been real busy in his second year of Junior College life. He has managed to take a little breather to write this article, and hopes to be able to find more spare time to write. He hasn’t had a chance to work on his website recently, but he did help to create one for the writers’ society at his college, of which he is a member.