Macromedia Flash makes it easy to put animation on the World Wide Web. Streamed through RealSystem, Flash clips can deliver visually arresting animations and e-commerce applications to RealPlayer. This chapter provides guidelines for creating and optimizing Flash clips that stream to RealPlayer. For instructions on developing Flash animation, refer to the Flash user's guide.
![]() |
Additional Information |
---|
Learn more about Flash from Macromedia's Web site at http://www.macromedia.com/software/flash. |
Flash is well-suited for linear presentations that have a continuous audio track and animated images synchronized along a timeline. Such presentations could include:
With Flash commands, you can build interactive icons and forms for:
This section explains how Flash works with RealSystem. This knowledge will help you produce high-quality streaming animation.
Streaming Flash version 3 or 4 to RealPlayer requires RealServer 8 or later. Earlier versions of RealServer stream only Flash 2. RealPlayer 8 or later is required to play Flash 3 or 4 clips. RealPlayer G2 or 7 will autoupdate to the latest RealPlayer release when it encounters a Flash 3 or 4 clip.
RealPlayer does not support the Flash 5 Player format. You can develop your animation with the Flash 5 program, but your exported Flash Player clip must be in the Flash 2, 3, or 4 format. Note that the Flash 5 program can automatically export and tune your clips in the Flash 4 format for streaming to RealPlayer.
As with any streaming clip, you develop a Flash clip with a target audience bandwidth in mind. The table "Maximum Streaming Rates" lists the highest rate at which your Flash clip should stream for various network connection speeds. Keep in mind, too, that if your Flash clip streams along with other clips, the combined streaming speed of all the clips should not exceed the maximum speed for the target audience. This helps ensure that your presentation does not rebuffer frequently.
Because most Internet users have 28.8 or 56 Kbps modems, RealNetworks recommends that you target dial-up modem audiences. Fortunately, Flash clips streamed over a 28.8 Kbps modems can have a visual impact comparable to that of a video streaming at a significantly higher bit rate. This is because Flash clips transmit vector information rendered by the viewers' computers. Hence, the quality of Flash animation depends more on a computer's CPU and graphics capabilities than on the amount of streamed data.
Because it is vector-based, Flash does not consume bandwidth evenly. When a scene starts, for example, its groups and symbols are streamed, requiring a lot of data transfer. After that, only lightweight instructions for manipulating groups and symbols are needed. This following illustration shows a Flash clip that targets a streaming speed of 12 Kbps. At 5 and 10 seconds into the clip's timeline, bandwidth use spikes because the clip needs more than 12 kilobits of data to change scenes or to introduce new objects in a key frame.
If it encounters spikes, RealPlayer buffers the data, delaying playback until all of the necessary data has arrived. For your clip to stream well, you must eliminate spikes by tuning the finished clip. Tuning the clip also sets the clip's streaming bit rate and preroll. The Flash 5 program can export and tune a clip automatically. Or, you can tune an exported clip manually with the Flash tuner included in the RealSystem Authoring Kit, which you can download from the following Web site:
http://www.realnetworks.com/products/authkit/index.html
Tuning your Flash clip guarantees that it streams at your chosen bit rate. If your animation is too complex, however, tuning it to a low bit rate may cause an unacceptably high preroll in RealPlayer. The best way to guarantee a low preroll is to keep the ratio of clip size to clip length low. The following are tips for keeping the Flash clip size as small as possible as you develop your animation:
Excessive key frame changes increase bandwidth consumption. Minimize the number of key frames and simplify the objects within key frames.
Flash stores a symbol once and can then refer to it at any time, with each reference adding little to the file size. However, it stores a group definition each time the group is used. Using a group three times, for example, stores the same data in the file three times. Using symbols instead of groups can therefore reduce file size significantly.
Simplify the elements that you draw or import into Flash. Under Modify>Curves, use the Smooth and Straighten commands on lines and curves to strip away unneeded point and path information. This reduces the amount of data stored for each element. Use Optimize to optimize the data reduction while maintaining acceptable screen appearance. Because screen resolution is lower than print resolution, you can eliminate minute details without compromising appearance.
As described in "Adding Audio to Flash", RealPlayer does not support event sounds. Including event sounds in the exported Flash Player clip wastes bandwidth. Either remove event sounds from the source Flash file (.fla) or export the Flash Player clip (.swf) without sound.
If your animation has imported graphics, set the JPEG quality to no greater than 50possibly as low as 30when exporting the .fla file to a .swf clip.
Bandwidth use is not the only consideration when developing Flash animation. Because it is vector-based, Flash performs complex calculations on the user's computer to display the animation. Operations that require many calculations on top of the computer's normal load may adversely affect playback. Newer computers typically have processors that are fast enough to handle Flash and other clips streamed in parallel, but older computers may not have this capacity. To support the widest audience possible, follow these recommendations to reduce Flash CPU requirements:
Macromedia recommends a Flash frame rate of 12 frames per second (fps). If you combine a Flash clip with another clip that needs considerable processing power, though, you may need to lower this frame rate to accommodate slow computers. Try 9 fps or 7 fps when combining Flash with RealAudio, for example. These rates provide acceptably smooth motion without overburdening most processors.
The tweening process interpolates the motion between key frames. Interpolating multiple objects and color effects at the same time will adversely affect playback. Other actions related to tweening that slow down playback include changing large areas of the screen between frames and using gradient fills.
RealPlayer must redraw areas where action occurs, thus consuming CPU power. To minimize this, localize tweening to a small portion of the screen so that the entire screen does not have to be redrawn. This way, file size remains the same, but only one part of the screen is redrawn.
RealPlayer does not support audio embedded in a Flash clip, so it will not play event sounds for mouseovers and button clicks, for example. You can include sound for a Flash clip only by exporting the soundtrack and encoding it as a RealAudio clip that plays in parallel with Flash. Therefore, audio tracks are beneficial primarily for linear clips such as a cartoons, rather than for interactive applications.
![]() |
Tip |
---|
Flash provides different methods for incorporating sound into an animation. Use the stream synchronization setting. |
To create separate animation and audio clips, you first synchronize your animation with an imported sound file, such as a WAV or AIFF file. You then export two files:
Using SMIL, you synchronize both clips for streaming. The Flash 5 program can create a SMIL file and export your soundtrack as a RealAudio clip automatically. If you use an earlier version of Flash, you need to export the soundtrack manually, encode it as a RealAudio clip, and write the SMIL file. "Streaming a Flash Clip" summarizes this exporting process.
When you export and encode your Flash soundtrack as a SureStream RealAudio clip, all viewers get the same Flash clip, but they get different RealAudio streams depending on their network connection speeds. For any network connection, determining your Flash and RealAudio clip speeds is a two-step process:
![]() |
Additional Information |
---|
The table "Maximum Streaming Rates" lists the streaming speeds for various network connection speeds. |
The following table lists possible RealAudio and Flash bit-rate combinations for 28.8 Kbps modems, which have a maximum streaming speed of 20 Kbps. If you choose an 8 Kbps music codec for RealAudio, for example, you have 12 Kbps of streaming bandwidth left for Flash.
Soundtrack Type | RealAudio Codec | Flash Maximum Speed |
---|---|---|
Voice | 5 Kbps Voice | 15 Kbps |
6.5 Kbps Voice | 13.5 Kbps | |
8.5 Kbps Voice | 11.5 Kbps | |
Music | 6 Kbps Music | 14 Kbps |
8 Kbps Music | 12 Kbps | |
11 Kbps Music | 9 Kbps |
Suppose you want to reach 56 Kbps modems, which have a maximum streaming speed of 34 Kbps. The following table lists some RealAudio codecs you can use, indicating for each codec the streaming speed left for the Flash clip.
Soundtrack Type | RealAudio Codec | Flash Maximum Speed |
---|---|---|
Voice | 6.5 Kbps Voice | 27.5 Kbps |
8.5 Kbps Voice | 25.5 Kbps | |
16 Kbps Voice | 18 Kbps | |
Music | 11 Kbps Music | 23 Kbps |
16 Kbps Music | 18 Kbps | |
20 Kbps Music | 14 Kbps |
To target both 28.8 and 56 Kbps modems, decide first how to reach the 28.8 Kbps audience. For a voice soundtrack, for example, you might use a 6.5 Kbps RealAudio voice codec, leaving 13.5 Kbps for Flash. To reach 56 Kbps modems, you would encode the soundtrack as a SureStream RealAudio clip using both the 6.5 Kbps voice codec and a 16 Kbps voice codec. Users with 56 Kbps modems then get 16 Kbps of RealAudio data along with the 13.5 Kbps Flash clip. This puts the streaming speed for this combination at 29.5 Kbps, a little less than the 34 Kbps maximum.
Here are some tips for selecting a RealAudio codec to use with a streaming Flash clip:
Because RealPlayer supports all Flash 3 and Flash 4 commands, you can make your presentations interactive by adding buttons and forms. In some cases, Flash commands work differently in RealPlayer than in the Flash browser plug-in. This section provides guidelines for using Flash commands with RealPlayer presentations.
Flash has several commands you can use to control the Flash clip's timeline. In a Flash 3 or 4 clip, these commands affect only the Flash clip. The presentation and all other clips playing along with the Flash clip continue through their timelines normally. In a Flash 2 clip, these commands affect all clips playing in RealPlayer.
Command | Action |
---|---|
Play |
Flash clip playback begins or resumes. |
Stop |
Flash clip pauses until a Play command is issued. With a Flash 3 or 4 clip, all other clips play normally. With a Flash 2 clip, all other clips pause. |
Go To and Stop |
RealPlayer seeks to the designated frame in the Flash clip and pauses. The Flash clip timeline resumes on a Play command. With a Flash 3 or 4 clip, all other clips play normally. With a Flash 2 clip, all other clips seek to the same point in the presentation timeline and then pause. See also "Go To Commands". |
Go To and Play |
RealPlayer seeks to the designated frame in the Flash clip, buffers the clip preroll, and begins playback. With a Flash 3 or 4 clip, all other clips play normally. With a Flash 2 clip, all other clips seek to the same point in the presentation timeline and then resume playback. |
Get URL |
RealPlayer sends the URL to the browser. Because the user has to return to the animation manually, use this only at the end of a clip. Also note that a SMIL file can define clickable hyperlinks that overlay a Flash clip. See "Linking to Other Media". |
As noted in the preceding table, commands such as Play, Stop, and Go To in Flash 3 and Flash 4 clips affect only the Flash clip. Using Flash's Get URL command, though, you can play, stop, or pause all clips playing in RealPlayer. You can also launch a URL in a new RealPlayer window. You do this by sending RealPlayer a command (rather than a URL) through Get URL.
The following value for Get URL instructs RealPlayer to seek to the specified time in the presentation timeline:
command:seek(time)
For example, the following command instructs RealPlayer to seek to 1:35.4 in the presentation timeline:
command:seek(1:35.4)
The time format is as follows:
dd:hh:mm:ss.xyz
Here, dd
is days, hh
is hours, mm
is minutes, ss
is seconds, x
is tenths of seconds, y
is hundredths of seconds, and z
is milliseconds. Only the ss
field is required. When the time value does not include a decimal point, RealPlayer reads the last field as the seconds. For example, 1:30
means 1 minute and 30 seconds, whereas 1:30:00
means 1 hour and 30 minutes. Note that all of the following commands are equivalent. Each seeks to the point 90 minutes into the presentation timeline:
command:seek(1:30:00.0)
command:seek(90:00)
command:seek(5400)
The following values for Get URL cause RealPlayer to play, pause, or stop the presentation, respectively:
command:play()
command:pause()
command:stop()
Using the Get URL command, you can open streaming presentations in new RealPlayer windows. In RealPlayer 7 or later, you can open as many player windows as the computer's CPU and memory allow. For complete information, see "Popping Up New RealPlayer Windows".
Use Go To commands only when adding interactivity to a Flash clip. Do not use them to advance from one scene to the next. When you export your animation in the Flash Player format, scenes are concatenated so that the animation flows from one scene to the next. A Go To command causes RealPlayer to seek to the target frame. If RealServer has not yet streamed the target frame, RealPlayer halts clip playback, issues a seek request to RealServer, and rebuffers the new data as it comes in.
When you use at least one Go To command in a Flash 3 or 4 clip, RealPlayer caches the entire clip in memory. It assumes that the clip is interactive and that the Go To commands are meant to move the viewer from one part of the clip to another based on input such as a button click. After RealServer has streamed the frames containing the Go To command and its target, RealPlayer does not need to rebuffer the clip when the viewer gives the command.
Using a Go To command raises RealPlayer's memory requirement for playing the clip. This is generally not a problem, because Flash memory requirements are low. When authoring long, linear animations, though, avoid using Go To commands whenever possible. When no Go To commands are present, RealPlayer discards clip data it no longer needs. This helps guarantee good-quality playback on computers that are low on available memory.
RealPlayer imposes a restriction on using Flash's Load Movie command to import a second Flash clip into a clip that is playing. If the clips use the RTSP protocol, RealServer stops the first clip and streams the second clip as a new RealPlayer presentation rather than streaming the second clip as part of the initial presentation. The Load Movie command works properly only when clips are downloaded with HTTP. There are two ways to manage this:
rtsp://
in the SMIL or Ram file URL for the clip. In a Load Movie command, use a fully qualified HTTP URL for the clip. RealPlayer will then request the clip with the given URL. This is the preferred solution because the first clip uses RTSP, which is a better protocol for streaming.
http://
in the SMIL or Ram file URL to the initial clip. In a Load Movie command, you can then refer to an imported clip using just its file name. RealPlayer requests subsequent clips using the same HTTP URL (except for the different file names) used to download the first clip.
If your presentation includes multiple Flash clips integrated with Load Movie commands, the RealPlayer slider reflects only the first clip's timeline. Suppose that a clip plays for five minutes and then loads another clip. The RealPlayer slider is active only for the five minutes the first clip plays. After that, the second clip plays normally, but RealPlayer indicates that the presentation has finished by resetting the timeline slider and disabling the stop button. Viewers can still perform interactive functions and stop the second clip by using Flash's contextual menu, though.
You need to use the Load Movie command to insert a new Flash clip into a Flash clip that is already playing. You do not need to use this command to play two or more Flash clips in sequence, though. Instead, you can use SMIL to define the sequence. This overcomes the URL and timeline limitations described above. To play two clips in sequence, for example, you write a SMIL file that looks like the following:
<smil>
<body>
<seq>
<animation src="rtsp://realserver.example.com:554/media/cartoon1.swf"/>
<animation src="rtsp://realserver.example.com:554/media/cartoon2.swf"/>
</seq>
</body>
</smil>
You can also use SMIL to combine each Flash clip with a RealAudio clip. The example below has two clip groups that play in sequence. Each clip group is composed of a Flash clip and a RealAudio clip played in parallel:
<smil>
<body>
<seq>
<par>
<animation src="rtsp://realserver.example.com:554/media/cartoon1.swf"/>
<audio src="rtsp://realserver.example.com:554/media/sound1.rm"/>
</par>
<par>
<animation src="rtsp://realserver.example.com:554/media/cartoon2.swf"/>
<audio src="rtsp://realserver.example.com:554/media/sound2.rm"/>
</par>
</seq>
</body>
</smil>
![]() |
Additional Information |
---|
For information on SMIL, see Chapter 6. |
With Flash forms, you can build transaction functionality directly into Flash clips streamed to RealPlayer. This lets you add e-commerce capability to your presentation, for example. If the Flash clip connects to a secure server, RealPlayer transmits the encrypted information through the viewer's browser. RealPlayer does not support encryption directly, so the viewer needs to have a browser that supports it. Any encrypted response sent back by the secure server displays in the browser.
RealPlayer tracks certain mouse events differently than does the Flash plug-in used with browsers. Although this does not change how you build a streaming Flash presentation and it will not affect most viewers, you should be aware of this behavior.
The Flash browser plug-in records mouse events that occur outside of the Flash area. For example, a user may click and hold on an icon, drag the pointer out of the Flash area, and release the mouse button. In this case, the Flash browser plug-in knows that the mouse button has been released. RealPlayer, however, does not record mouse events that occur outside of its Flash region. Instead, it assumes that the button is still held down when the pointer returns to the Flash region.
This section summarizes the process for streaming a Flash clip. The Flash 5 program can export a RealAudio clip, a tuned Flash Player clip, and a SMIL file automatically. If you use Flash 5, refer to your Flash user's guide for instructions on exporting and tuning clips. Macromedia's Web site also provides information about exporting clips with Flash 5:
http://www.macromedia.com/support/flash/publishexport/realplayer/realplayer.html
If you are using a version of the Flash program prior to version 5, you must perform the following export and tuning steps manually.
RealServer streams only the Flash Player format (.swf), which is a compressed version of the animation. You cannot stream the Flash source file format (.fla
). If your animation includes a soundtrack, disable the audio stream when you export the clip. Refer to the Flash user manual for step-by-step instructions on the exporting a Flash Player clip.
![]() |
Note |
---|
Keep in mind that RealPlayer plays the Flash 4, 3, and 2 Player formats. It does not play clips in the Flash 5 format. |
With the Flash tuner, set the clip's streaming bit rate. This necessary step also eliminates bandwidth spikes that can cause rebuffering. The Flash tuner is included in the RealSystem Authoring Kit, available at this Web site:
If your animation includes a soundtrack, export the soundtrack as a Windows WAV file or Macintosh QuickTime file. If exporting to QuickTime (or any other video format), set low height and width attributes to minimize disk space use.
Encode the exported WAV or QuickTime soundtrack in the RealAudio format with RealProducer, using the file extension .rm.
Transfer your clips to RealServer. Then write the SMIL and Ram files necessary to stream the presentation.
If your have a single Flash clip, your RealServer administrator can give you the URL to use in your Web page's hyperlink to the clip. If the RealServer does not use Ramgen, or you are delivering the clip through a Web server, you need to write a Ram file.
![]() |
Additional Information |
---|
For more on RealServer and Ramgen, see "Streaming Clips from RealServer". Ram files are described in "Creating a Ram File Manually". |
If your presentation has multiple clips, you write a SMIL file that organizes the presentation and gives the clip URLs. You next link your Web page to the SMIL file. In its simplest form, the SMIL file gives the full URLs to the clips and specifies that the clips play in parallel. The following example is for a Flash clip that plays in parallel with a RealAudio soundtrack:
<smil>
<body>
<par>
<audio src="rtsp://realserver.example.com:554/media/sound.rm"/>
<animation src="rtsp://realserver.example.com:554/media/cartoon.swf"/>
</par>
</body>
</smil>
You can also use SMIL to define hypertext links, create timing offsets between clips, or add presentation information such as title, author, copyright, and abstract. For complete information on SMIL, see Chapter 6.