Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Adobe Creative Suite

Flash Reference Guide

Hosted by

Toggle Open Guide Table of ContentsGuide Contents

Close Table of ContentsGuide Contents

Close Table of Contents

Using SMIL in Flash Video 8

Last updated Aug 22, 2003.

Flash 8 has a significant improvement in video streaming over Flash 6 and 7. One of the new features you’ll see is support for SMIL, which is an external declarative document that explains where your video is located. The advantage you gain is that you can store your external video wherever you like.

SMIL is a formalized W3C endorsed XML structure describing rich media playback and synchronization. You can read the complete document here.

Flash 8 uses a simple version of SMIL. The following document describes a video type and where it is located in relationship to the Flash movie:

<smil>
 <body>

  <switch>
   <video src="flash8Video.flv" />
  </switch>
 </body>
</smil>

This SMIL code should be saved as an XML file. In this instance, let's call it "myVideo.xml." You’ll see that the SMIL file is pointing the FLV file.

Adding SMIL to the Flash FLVPlayBack Component

To use SMIL, you need to use Flash’s new FLVPlayBack component. It’s located in the Flash 8 Component Panel as shown below:

Figure 1

Figure 1 Drag an instance of the FLVPlayBack component onto the Stage. At this point, save the file as "myVideo.fla" in the same folder as the SMIL XML file.

You can now modify the Parameter settings for the FLVPlayBack component. Select the ContentPath parameter and enter "myVideo.xml" as shown in the following screen shot:

Test the Flash movie. You should see that the local FLV file plays back inside of Flash.

Additional SMIL Settings

There are additional parameters, which dictate hosting server location, elapsed duration of the video file, and bandwidth detection, that can be added to the SMIL file. The following example SMIL file demonstrates this:

<smil>
  <head>
    <meta base="rtmp://myserver/mypgm/" >

    <layout>
      <root-layout width="240" height="180" >
    </layout>
  </head>

  <body>
    <switch>
      <video src="myvideo_mdm.flv" system-bitrate="56000" dur="3:00.1">
      <video src="myvideo_isdn.flv" system-bitrate="128000" dur="3:00.1">

      <ref src="myvideo_cable.flv" dur="3:00.1"/>
    </switch>
  </body>
</smil>

As you can see, support for SMIL makes it really easy to configure Flash Video source files and add in additional streaming controls. There are some pitfalls to using SMIL in Flash 8; like I said at the beginning of this article, it’s only a partial implementation of the full SMIL standard. But, the benefits to using SMIL can be gained on small video projects. For advanced projects, you’ll need to leverage the tools in the Flash Media Server.