19 February 2008
The Adobe Flash video component in Adobe Dreamweaver CS3 helps you easily insert and display video files in your websites. It's great for Dreamweaver users who are unfamiliar with Flash because you can insert Flash video (FLV) files on your web pages without actually using the Flash authoring tool. The Flash video component enables you to select from several different playback controllers that visitors use to control the FLV file playing on your web page. You can choose also between two different options for delivering your video: progressive download or streaming.
This article shows you how to use Dreamweaver CS3 to insert and display FLV files on your site. The Flash video component uses a wizard interface that enables you to choose display and delivery options and even preview the player's design (skin) before you insert it on a web page. Despite the automated way that code is inserted onto a web page, you do have control over the end result. Using the Flash video component isn't the only way to display FLV files on the web, but it's fast and easy.
In order to follow the steps in this tutorial, you must install Dreamweaver CS3 and download the farm_cs3.zip sample file from this tutorial's introductory page.
Extract the contents of the farm_cs3.zip sample file you downloaded to a new folder on your desktop called farm. The ZIP file contains an entire Dreamweaver template website, including Flash video (FLV) files. You will work with the files in the farmsite folder during this tutorial. You can compare your work to the finished files in the finished folder.
The website template that you use for the following exercises has a distinct farm theme (see the sample site). The farm site consists of nine main folders, seven templates, a few dozen static HTML pages, and a Cascading Style Sheet (see Figure 1). The purpose of the website is to create a gallery of images and videos for six common farm animals. Each animal has its own subfolder where you store HTML pages specific to that animal. For example, you store pages that display images or videos that relate to chickens in the chickens folder. You use the last three folders (called images, videos, and Templates) to organize the images, videos, and templates for the farm site.
The site has a basic three-column design, where the left column contains the main site navigation and the middle column displays content (text, images, and video). You nest templates in the right column to display thumbnail images for both videos and static images of animals (see Figure 2).
Using nested templates enables you to add new pages easily to the site and automatically have the subnavigation added for you. Also, making changes to the animal-specific templates causes the changes to cascade to any file using that template. So if you need to modify the subnavigation within the chicken template, all files based on that template are updated automatically.
In this exercise, you insert an FLV file with a controller into a supplied web page in several easy steps.
You have two options when you insert and display an FLV file in your HTML documents using the Flash video component:
Note: The FLV video included with the article source files uses the Sorenson Spark codec and can be viewed with Flash Player 6 r65 or later.
Note: For more information on using video on the web, see the Flash video learning guide.
Depending on which video type you select in the pop-up menu, the following steps will vary slightly. This tutorial assumes you've chosen the Progressive Download Video option to display your video files:
[insert video here].
Note: For more information on this issue, please see the following TechNote: Cannot insert Flash Video in template child pages.
Based on the settings that you chose for this exercise, Dreamweaver inserts the following code into your web page (the highlighted code is explained next):
What does this all mean? The parameters you specify in the Insert Flash Video wizard are inserted into this HTML snippet, which pass information to the SWF file using
FlashVars (see the note below). The skin, called
Clear_Skin_3, is copied to the same folder as the current HTML file, although it omits the file extension (.swf) in the HTML code. The second parameter,
streamName, points to the FLV file you defined in the URL text box. It is a relative path and again omits the FLV file extension (.flv).
FlashVars is a mechanism for passing variables to the SWF file through name-value pairs in the HTML. The name-value pairs end up as variables on the root timeline of the SWF file. This is a great way to import assets paths and simple parameters into your SWF file.
The next two parameters are Boolean (
false) values, which are based on your selections in the wizard. If you want to modify the skin or path to the FLV file, then you can modify these values directly using Code view in Dreamweaver. You might need to edit the
height parameters manually in both the
embed tags. These values represent the width and height of the FLV document, respectively. However, if you use certain default or custom skins, you might need to modify these values if your skin contains a border and is larger than the dimensions of the FLV file.
Due to cross-browser issues, you need to define the
FlashVars values in both a
param tag as well as the
embed tag so that the code works with Microsoft Internet Explorer–based and Netscape-based browsers
Note: The actual SWF file you need to drive the Flash video component is a mere 10–12K, depending on whether you select the progressive download or streaming option. Using one of the default skins adds approximately another 4–11K, depending on the skin you choose.
This tutorial demonstrates how easy it is to add video to existing web pages using Dreamweaver and the Flash video component. With only a few clicks of the mouse, you can embed an FLV file using the default skins.
With a bit of extra work (and Flash CS3) you can also create a custom skin that matches your website. To find out how to customize playback controllers using Flash, check out the Dan Carr's article, Controlling Flash video with FLVPlayback programming.
With a bit of creativity, you can create much better skins and projects using the Flash video component.
No animals were harmed in the making of this article.