Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Setting Up Flash Media Server

Setting Up Flash Media Server

To make this application to work, you need to configure File Access and Stream Access.

File Access

The File Object class allows access to a sandbox within your server file system. To protect against any misuse, Flash Media Server allows access to files within a sandbox specified for the virtual host where the application instance is running.

To define your server-side sandbox, go into your application.xml file in the FileObj folder. Define where you are storing the FLVs and MP3s that you wish the server to find:

C:Program FilesMacromediaFlash Media Server 2applications

You have just enabled secure file access to this defined sandbox. You can set up multiple file object directories by consecutively adding virtual directories.

Stream Access

You will also need to set up your Vhost.xml, which you can find in your conf/_defaultRoot_/_defaultVhost_/ subfolder in the Flash Media Server 2 folder because you must tell the server when you call “/approot” from the Vhost instance that it should look in the specified directory. You will need to define where you streams are located (should be the same as the setting you defined earlier for FileObject):

C:Program FilesMacromediaFlash Media Server 2applications
</Virtual Directory>


Setting Up Flash Media Server

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 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:

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

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.