The ActionScript 3 FLVPlayback component lets you easily include a video player in your Adobe Flash CS4 Professional application. With the FLVPlayback component you can play progressively downloaded Adobe Flash Video files over HTTP or play streaming video files from Adobe's Flash Media Server or from Flash Video Streaming Service (FVSS).
Prior to Flash Player 9, the FLVPlayback component supported only video files in FLV format. Flash Player 9, Update 3 added support for high-definition MPEG-4 video formats that use standard H.264 encoding. These formats include MP4, M4A, MOV, MP4V, 3GP, and 3G2. The FLVPlayback component does not, however, support protected MP4 file such as those downloaded from Apple iTunes or digitally encrypted by FairPlay.
Note: For more information about the FLVPlayback component and Flash Player 9 Update 3 (ver. 9,0,115,0), read Using the FLVPlayback component with Flash Player 9 Update 3.
You can find the FLVPlayback component in the Components panel under the Video tree control. Below this component are several FLVPlayback Custom UI components, which provide individual buttons and control mechanisms that you can customize and use to play, stop, pause, and otherwise control a video.

The FLVPlayback component also includes a set of prebuilt skins that incorporate playback controls. For more information on these skins, see the Applying skins and playback controls section of this article.
This article covers the following topics:
You can add the FLVPlayback component to your application in the following ways:
Note: When you add the FLVPlayback component to your application, if you do not set the source or skin properties, the generated movie clip appears to be empty. For information on specifying a video file and applying a skin to FLVPlayback, beyond what is provided in the following procedures, see Specifying the video file to play and Applying skins and playback controls.
With the FLVPlayback component selected on the Stage, click the source parameter in the Component inspector and enter
a string that specifies one of the following:
skin parameter.Select one of the following options:
In the first two cases, a preview of the skin appears in the viewing pane above the drop-down menu.
Select File > Import > Import Video to start the Video Import wizard.

Indicate the location of the video file by selecting one of the following options:
If you selected a file path, you'll next see a set of radio buttons from which you can select one of the following options to specify how you would like to deploy your video:
Note: Do not select the Embed Video option. The FLVPlayback component plays only external FLV files or streaming video. This option will not place an FLVPlayback component on the Stage.
Select one of the following options:
From the drop-down Skin menu, select one of the prebuilt skins to attach a set of playback controls to the component. A preview of the skin appears in the viewing pane above the drop-down menu.

import fl.video.*; var flvPlayer:FLVPlayback = new FLVPlayback(); addChild(flvPlayer); //The next line assumes you have copied the skin file to the local directory flvPlayer.skin = "./SkinUnderPlaySeekMute.swf" flvPlayer.source = "http://www.helpexamples.com/flash/video/water.flv";
To download the source files for this example, click here.
You can specify the video file for the FLVPlayback component to play in the following ways:
source parameter in the Component inspector.source parameter in the Component inspector to
open the Content Path dialog box.
The Match source dimensions option specifies whether the FLVPlayback instance on the Stage should match the dimensions of the source video file. The source file contains preferred height and width dimensions for playing. If you select this option, the dimensions of the FLVPlayback instance are resized to match these preferred dimensions.
You can also specify the name and location of the video file using the ActionScript FLVPlayback.source property or the FLVPlayback.play() and FLVPlayback.load() methods. The source property and both of the methods take precedence over the source parameter in the Component inspector because you set them at runtime. For more information, see FLVPlayback.source, FLVPlayback.play(), and FLVPlayback.load() for the FLVPlayback class in the ActionScript 3 Language and Components Reference.
You can select a skin for the FLVPlayback component by clicking the Value cell for the skin parameter in the Component inspector. Then click the magnifying glass icon to open the following Select Skin dialog box,
in which you can select a skin or provide a URL that specifies the location of the skin SWF file.

Skins that are listed in the Skin drop-down menu are located in the folder Adobe Flash CS4\Common\Configuration\FLVPlayback Skins\ActionScript 3.0. You can make new skins available to this dialog box by creating them and placing the SWF file in the folder. The skin name will appear in the drop-down menu with a .swf extension. When you publish the SWF file containing the FLVPlayback component, the skin files are automatically copied to the same folder as the SWF file.
You can also apply a skin to an FLVPlayback instance by setting the skin property using ActionScript. For an example, see Use ActionScript to create an FLVPlayback instance dynamically.
The FLVPlayback preview parameter in the Component inspector lets you view a frame of the source video file on the Stage along with
any changes that you make to the component's skin. Clicking the preview parameter opens the following dialog box, which plays the source file.

Click OK when the video reaches the scene that you would like to capture for previewing the component on the Stage. Displaying a frame of the file in the component on the Stage enables you to see it in relationship to other elements of the component and the application on the Stage .
Note: This has no effect on what you see when you run the published SWF. If you want to load a poster image of the video at run time, use the Export button to export this image as a PNG file and write ActionScript to load it in at runtime. That exercise is beyond the scope of this article, however.
For more information about the FLVPlayback component, see the following resources:
If the FLVPlayback component does not meet your needs, and you prefer to create your own custom video player, read Handling metadata and cue points in Flash video for some useful tips.
Related Flash Quick Starts
Bob Berry is a senior technical writer with Adobe Systems, Inc. Prior to joining Adobe, Bob worked at Macromedia for four years, at IBM briefly, and at Informix Software for 10 years.