With Flash Professional 8 come a lot of components, including the FLVPlayback component that will help speed application development of streaming media applications.
With the FLVPlayback component, you can drag it onto the stage, set a single parameter, and you now have a streaming media application. It is really that easy, as you will see. To further increase its usefulness, you can also automatically create an instance of it, with the selected skin you want, when you import the video. But for this example, we will go step-by-step.
The FLVPlayback component is for the Flash Player 8 only, and if FLVPlayback component is published in a lower version, it will throw an error. For Flash player 6 and 7, use the Media Components that are also included with Flash Professional 8.
Before we start using the FLVPlayback component, we should look at its parameters. Drag an instance of the FLVPlayback onto the stage, select it, and open the Properties Inspector (Window, Properties, Parameters). Following are the properties for the FLVPlayback component and a short definition:
autoPlay If set to true, the FLV will play immediately when it is loaded. Otherwise, it will wait for ActionScript or user interaction to begin playing. The default value is TRue.
autoRewind If set to true will automatically take the FLV back to the beginning once it has either reached the end of the video, or a user hits the stop button. The default value is true.
autoSize If set to true, the FLVPlayback component will resize itself at runtime to the dimensions of the FLV. The default value is false.
bufferTime The number of seconds to hold in the buffer before it will start playing (similar to the bufferLength of the NetStream object). The default value is 0 seconds.
contentPath A string path (relative or absolute) to the FLV player, or an XML document (for streaming services only) describing how to play the FLV. Double-clicking this parameter (or clicking the little magnifying glass on the right side of it) will open the Content Path dialog box, as shown in Figure 26.5, which will allow you to browse to your file or type it in manually. The default value is an empty string.
Figure 26.5. The Content Path dialog box.
cuePoints A list of cue points in a string. Cue points allow you to sync other media in your Flash file to the playing FLV file. You can double-click this parameter, and the Flash Video Cue Points dialog box will appear, as shown in Figure 26.6, allowing you to set the different cue points in your video. The default value is None or an empty string.
Figure 26.6. The Flash Video Cue Points dialog box.
isLive If set to TRue, it indicates the file is coming from a streaming server and should be treated as such. The default value is false.
maintainAspectRatio If set to true, the FLVPlayback component will resize itself at runtime to match the aspect ratio of the FLV file. The default value is TRue.
skin This parameter allows you to select from several premade skins for the FLVPlayback from the Select Skin dialog box shown in Figure 26.7. The default choice is your previously selected skin.
Figure 26.7. The Select Skin dialog box.
skinAutoHide If set to true, the interface for the player will disapear when not in use and reappear when the user moves the mouse over or near the FLVPlayback component at runtime. The default value is false.
totalTime The total amount of seconds in the FLV file. If the FLVPlayback component is set for progressive download, this parameter will be used if the value is greater than 0. If the component is set for streaming, it will attempt to grab the totalTime from the metadata of the FLV itself. The default value is 0.
volume The initial value of the volume for the FLV. The default value is 100.
Now that you have seen the parameters, let's see how easy it is to create a media application with this component:
Create a new Flash document.
Save it in the same directory as the Flash Video as flvPlaybackExample.fla.
Drag an instance of the FLVPlayback component onto the stage.
Set its contentPath parameter to cats.flv.
Test the movie.
Figure 26.8. Use the FLVPlayback component to build media applications quickly.
That's it! That is all it took to build a media application.
You just learned how to play video, but there is another object you can send to the Video object: the Camera object.