Streaming RealMedia on the Internet

Contributed By


A brief but detailed look at streaming RealMedia form your website.

OK, we have covered the bare basics of streaming in a previous article. To expand on that idea by adding articles concentrating on a specific format, and today's winner is RealMedia.

Real Networks are one of (if not the) first internet streaming formats. In order to stream RealMedia you need an application that will turn your audio or video file into a ".rm" file, this is the file format of RealMedia. Obviously Real Networks has an application called "RealProducer" that is a very easy to use program that has a simple interface and totally idiot-proofs the process of making your RealMedia. Also many high-end studio applications such as Sound Forge encode RealMedia as well and some of them (including Sound Forge) are not as easy, but contains a lot more options to fine-tune your stream speed and quality.

Once you have your .rm file you are not finished. That is just the first step. You must now decide if you want to embed the player in your webpages or have the file open in the visitors RealPlayer program (or whatever program they have associated with RealMedia).

Opening the associated application

If you want to open the visitor RealPlayer, or other associated program, keep in mind you have no control over which one opens, whichever program the visitor has set to open for RealMedia on their PC is the one that will open, and apps like Windows Media Player, RealPlayer and Quicktime player generally fight for control so it could be any of those, typically whichever one the visitor most recently installed.

To play the RealMedia in this fashion you need to create an ".ram" file. The RAM file is a simple text file you can create in Windows Notepad or any text editor. and there is simply only one line of text in it, the full URL to your .rm file. The only difference being the beginning of the URL, instead of http:// you put pnm:// so if you are making "yoursong.rm" stream from your website www.mymusic.com" your .ram file would read pnm://www.mymusic.com/yoursong.rm and save it as, for example, yoursong.ram. I like to name them the same because if you have many streams at your website the files then show up right next to each other in the file listing via FTP.

Simple, eh? Now, upload both yoursong.rm and yoursong.ram to your website and create a link that goes to yoursong.ram, when the link is clicked the Player will open, it will read yoursong.ram which will tell it to grab yoursong.rm and a streaming you will go.

Embedding the Stream in the webpage

OK, so you would rather embed, I don't blame you, it is way more professional looking, but really not much harder. The major difference is adding a webpage with the proper HTML and instead of an .ram file, you make an .rpm file.

The .rpm file as well contain only one line of text, just the full URL to the .rm file in standard http:// format so using the same file names as above, the file yoursong.rpm would have this line of text; http://www.mymusic.com/yoursong.rm. How easy is that!

Now, on to the HTML. It is a simple object/embed combination of tags, much like Flash and other objects. The reason we need both is to, of course, support both Internet Explorer and Netscape, one uses embed and one uses Internet Explorer (I forget which is which).

The first chunk of needed HTML is the window, if it is only audio this window will just display the RealMedia logo. The HTML is as follows:

<object id="video1" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" height="168" width="228"><br> <param name="controls" value="ImageWindow"><br> <param name="console" value="Clip1"><br> <param name="autostart" value="false"><br> <param name="src" value="yoursong.rpm"><br> <embed src="yoursong.rpm" type="audio/x-pn-realaudio-plugin" console="Clip1" controls="ImageWindow" height="168" width="228" autostart="false"><br> </object>

Your will see both the embed and object code contain the same parameter options, width and height - which control the size of the playback window, controls - is always "ImageWindow" until we get to the control panel tags, autostart - which is true or false (true it autostarts on page load and flase it starts when play is pressed on the control panel) and then src which is the link to the .rpm file, in this example, yoursong.rpm.

That's easy, eh? Now comes the control panel...that code is like so:

<object id="video1" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" height="125" width="275"><br> <param name="controls" value="All"><br> <param name="console" value="Clip1"><br> <embed type="audio/x-pn-realaudio-plugin" console="Clip1" controls="All" height="95" width="275" autostart="false"><br> </object>

The only needed parameters for this section is width and height, plus the type of control panel you want. Here there are five options you can use in the controls param for the control panel and what they look like:

All
StopButton
ControlPanel
ControlPanel,InfoVolumePanel
ControlPanel,StatusBar

And that pretty much sums up embedding RealMedia into a webpage. Lastly, the RealProducer also spits out some META tags and comments that it claims are required, to the best of my knowledge the are not, but in the interest of full disclosure I thought I would include then here:

<meta name="GENERATOR" content="RealProducer G2"><br> <meta name="rnpagelayout" content="embedded"><br> <meta name="rnserverpath" content="http://www.mymusic.com/"><br> <meta name="rnmediafile" content="yoursong.rm"><br> <meta name="rnmetafile" content="yoursong.rpm"><br> <meta name="description" content=""><br> <meta name="keywords" content="">

Related Forum Topics:



User-submitted comments


Jbon
Jan 08, 2004 08:02 pm
dB is a saint
I do not know how he finds time but it is true, based only on what you can see hereabouts,a favorite home-recordists site, for me.
This info on how to stream has gotten me well on my way, too. Every day when I turn my computer on the first thing I do is look at my newest page where I am attempting to put to use the knowledge from that "real" article on streaming, and I know that one of these days I will figure out how to get it right!
It did not say if you should "hyperlink" the html, and I am trial and erroring all the different ways the instructions could be carried out, but its a little slow-going, so far.
I am looking for more material to read so as to maybe gain a broader understanding of the concept, In case there is another useful page on streaming from an embedded website,I'd be grateful to have it brought to my attention. Thanks, Jbon


Jbon
Jan 08, 2004 08:19 pm
what is "src"
Your will see both the embed and object code contain the same parameter options, width and height - which control the size of the playback window, controls - is always "ImageWindow" until we get to the control panel tags, autostart - which is true or false (true it autostarts on page load and flase it starts when play is pressed on the control panel) and then src which is the link to the .rpm file, in this example, yoursong.rpm.



dbmasters
Jan 09, 2004 04:33 am
on src
SRC is a common shortening of the word "source" the src param should always point to a source file.


If you would like to leave comments to the articles you read, feel free to register for your free membership.