Understanding the XML Data Source

December 31, 2009

How To

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.

, ,

Subscribe

Subscribe to our e-mail newsletter to receive updates.

No comments yet.

Leave a Reply