Setting Up Flash Media Server

September 11th, 2006 by Posted in Macromedia Flash, Macromedia Products

Setting Up Flash Media Server

This article assumes that you are running Flash Media Server locally, but the application setup would be the same if you were using a remote server:

  1. Create a folder under the applications folder in Flash Media Server called VideoSource.
  2. Create a streams folder inside VideoSource.
  3. Create a _definst_ folder inside the streams folder.
  4. Place the Flash video files that you wish to appear in your playlist in this _definst_ folder.

That’s all the setup required on the server side.

In a bit, you’ll construct the VideoSource.as ActionScript code. However, let’s first take a look at the XML file you will use to dynamically build your video playlist.

Understanding the XML Data Source

In this section, I explain the structure of the sample XML data file, playlist-demo-1.xml, which is included in the sample file ZIP for this tutorial.

To add new videos to your playlist dynamically, simply edit this file:

<xml>
<listitem name="Wind Sculptures" url="rtmp://localhost/videosource/">
<stream name="wind" start="0" len="-1"/>
</listitem>
<listitem name="The Trike" url="rtmp://localhost/videosource/">
<stream name="trike_final" start="0" len="-1"/>
</listitem>
<listitem name="Fluffy Hammer" url="rtmp://localhost/videosource/">
<stream name="fluff_hammer" start="0" len="-1"/>
</listitem>
<listitem name="Fluffy Crash" url="rtmp://localhost/videosource/">
<stream name="fluffy_crash" start="0" len="-1"/>
</listitem>
<listitem name="SuperSkate" url="rtmp://localhost/videosource/">
<stream name="discodance" start="0" len="-1"/>
</listitem>
<listitem name="The Fish" url="rtmp://localhost/videosource/">
<stream name="fish" start="0" len="-1"/>
</listitem>
<menu>
<listitem name="Wind Sculptures"/>
<listitem name="The Trike"/>
<listitem name="Fluffy Hammer"/>
<listitem name="Fluffy Crash"/>
<listitem name="SuperSkate"/>
<listitem name="The Fish"/>
</menu>
</xml>

Notice that the file has a very basic XML structure, holding two main things:

  • listitem (items with name and length attributes)
  • menu (items to make available for selection)

The url attribute must point to your server running Flash Media Server. (For the purpose of this article, I assume you are doing so locally.) To point to your own FLV files, change the stream name to your FLV filename (omitting the .flv extension). These filenames should correspond to those you placed in the “streams” folder on the FMS server in the previous section. Just remember to leave off the .flv extension in the XML file, as shown in the example.

OK, ready for the fun part? The next section gets into the meat of the application—the client-side ActionScript.