A Crash Course in Flash Video

Article Featured Image
Article Featured Image

Another navigation issue to note is the smoothness of the playback when seeking. Progressively downloaded video can only seek to keyframes. Therefore, if you choose a spot that’s between keyframes, the video will snap forward or backward to a keyframe, resulting in a "stuttering" navigation. This can be a bit frustrating to viewers who are trying to jump to a specific point in a video. Streaming video doesn’t have this issue at all, as keyframes are generated on-the-fly by the streaming server, as needed.

• Is the video content copyright-sensitive? When serving video via progressive download, the FLV data is actually cached and stored on the viewer’s hard drive. The file is not easily located, but any somewhat tech-savvy teen could figure out where it is, grab the FLV, and share it to his heart’s content. This can be a real problem for content creators who are concerned about where their videos end up. In streaming delivery, the data is displayed as it’s received then flushed from memory, so it’s never cached or saved.

• Are you concerned with bandwidth consumption and server load?If you’re watching your bandwidth calories carefully, you may want to choose streaming. Unlike progressive download, streaming only delivers the data that’s displayed. If the viewer stops watching the video halfway through, you’ve only transferred half of the video file. If they were watching a progressive video, the whole video may have been downloaded and cached by the time they’ve watched half. So you’ve just transferred twice as much data as you needed to for the same experience. Cha-ching.

• Do you want to have the ability to detect the viewer’s bandwidth fluctuations and adjust the quality of the video to assure a smooth viewing experience? One great benefit to streaming video is the ability to swap out the video on-the-fly during playback. You can detect the viewer’s bandwidth, and if it dips, you can swap in a lower-bit rate video without interrupting their viewing experience. You can detect bandwidth when using progressive delivery as well, but you’d have to stop playing the current video and start playing the lower-bit rate video from the beginning. (Caveat: there are ways to start playback in the midpoint of a progressive video, but they involve some tricky server-side scripting.)

• What’s the scale of your project? Will there be steady, heavy traffic or traffic spikes? If you expect a lot of viewers (one can hope!), you may want to consider hosting your videos with a content delivery network (CDN). CDNs offer load balancing and geo-targeting to assure fast, reliable video delivery. These services can be used for both progressive and streaming video.

Though most CDNs offer support for Flash Video, there are five companies that have officially partnered with Adobe to fully support Flash Video streaming: Akamai, Limelight, VitalStream, Mirror Image, and J-Stream. These companies participate in the Flash Video Streaming Service (FVSS) program, working closely with Adobe to optimize their networks specifically for FLV streaming using Flash Media Server. If you’re going to stream large amounts of Flash Video, I recommend that you look at one of these companies first.

How Do I Get FLVs into Flash?
All right, now that all that is settled, let’s take a look at how you actually get an FLV to play in Flash. There are two options: the FLVPlayback component or a Video object.

Arguably the easiest way to play an FLV is by using the FLVPlayback component that ships with Flash (Figure 2). There are a variety of player control skins available to use with the component, or you can create your own. The newest version of the FLVPlayback component that ships with Flash CS3 is actually pretty easy to customize (compared to the older Flash 8 component). This new CS3 version was completely rewritten to be easier to skin, and has a much smaller file size.

Figure 2 (below). Using the FLVPlayback Component in a SWF to play back an FLV.

Figure 2

Using the FLVPlayback component is quite easy; it’s just a matter of dropping the component on the stage in Flash, setting a few parameters, and publishing your movie. Let’s walk through the process:
1. Open a new document in Flash. If you’re working in Flash 8, you’ll be creating an ActionScript2 file. In Flash CS3, you can choose to create either an ActionScript 2 file or an ActionScript 3 file. If you choose AS2, it will be playable in Flash Player 8 or 9. If you choose an AS3 file, viewers will need Flash Player 9. (In these examples, though we’re working in Flash CS3, the steps for Flash 8 are virtually the same. I’ll point out any differences along the way.)

2. Open the Components panel, if it’s not open already. You’ll see a menu similar to Figure 3. From the Video directory in the panel, click and drag an FLVPlayback component onto the stage. Your stage should look something like Figure 4.

Figure 3 (below). The Components panel menu

Figure 3

Figure 4 (below). Using the FLVPlayback component in Flash CS3.

Figure 4

Streaming Covers
Free
for qualified subscribers
Subscribe Now Current Issue Past Issues