This indirect linking process is demonstrated in the following two examples.
24.7.3.1. Linking to RealMedia (external player)
When the user accesses RealMedia via a link (using the <a> tag), the browser launches the external RealPlayer application.
In the HTML document, make a link to the metafile that points to the RealMedia file as follows:
<A HREF="song.ram">Link to the song</A>
When linking to RealMedia, the metafile uses the .ram suffix. The metafile is a small text-only file that contains only the URL that points to the RealAudio file (suffix .rm or .ra):
pnm://domainname.com/song.rm
24.7.3.2. Embedding RealPlayer on the page
To place the RealPlayer controls in the web page itself, use the <embed> tag for Netscape Navigator (Version 4 and earlier) and the standards-compliant <object> tag for Internet Explorer (all versions) and Netscape 6. To reach both browsers, you may use a combination of the two as shown in the following examples. This method uses the RealPlayer plug-in for playback.
It should be noted that the audio stops playing when the user leaves the page. Also, it is more difficult to get consistent cross-browser performance when the player is embedded. For these reasons, it is generally preferable to link to the audio and use the external player.
The following sample code uses both the <object> (with parameters) and <embed> tags to embed the player on the page. When RealMedia is embedded, the suffix of the metafile should be .rpm. This tells the browser to start playing the media in the browser window.
<OBJECT ID="oakshoessong"
CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"
HEIGHT="150" WIDTH="250" BORDER="0">
<PARAM NAME="SRC" VALUE="realmedia/oakshoes.rpm">
<PARAM NAME="CONTROLS" VALUE="all">
<EMBED SRC="realmedia/oakshoes.rpm" HEIGHT="150" WIDTH="250"
AUTOSTART="false" CONTROLS="all" BORDER="0">
</OBJECT>
Let's start by looking at the <embed> tag, which is used by older versions of Netscape. It contains attributes for pointing to the metafile (src), specifying the size of the embedded player (width, height), whether the file starts playing automatically (autostart), whether it displays control buttons (control), and a border (border).
These same settings are made in the <object> tag using attributes and additional parameters (indicated by the <param> tag). It important that the classid attribute be specified exactly as it is shown in the example, as it is the unique identifier of the RealAudio plug-in. This may not be changed.
The easiest way to create the HTML code for handling RealAudio is to use the RealProducer or RealPublisher tool and allow it to do the work for you. RealNetworks also provides developer information at
http://www.realnetworks.com/devzone/. The process for naming and accessing RealAudio has changed several times over the last few years, so be sure to refer to current documentation for up-to-date instructions.