2.5. Adding Audio and Video to the Chat Room
To add audio/video streaming
capabilities to the chat room, you can add the AudioConference,
AVPresence, or VideoConference component to the Flash document you
created in the last section. In the following steps, you will add two
instances of the AVPresence component and an instance of the
SetBandwidth component to the movie:
Open the component_chat.fla from the last
section. Resave this document as
component_avchat.fla. Create two new layers, named av_1_mc and
av_2_mc. On frame 1 of the av_1_mc layer, drag an
instance of the AVPresence component from the Components panel to the
Stage. Place the instance to the right of the ConnectionLight
instance and above the Chat instance. In the Properties panel, name
this instance av_1_mc. Repeat the previous step for another instance of the AVPresence
component. Place the new instance on frame 1 of the
av_2_mc layer, positioned to the right of the
av_1_mc instance. Name the new instance
av_2_mc. Create a new layer named bandwidth_mc. On frame
1 of this layer, drag an instance of the SetBandwidth component to
the Stage. Place the instance below the
userColor_mc instance. Name the new instance
bandwidth_mc using the Properties panel. Your
Stage should now resemble Figure 2-24.
 Select the connect_mc instance on the Stage, and
double-click its Communication Components parameter in the Parameters
tab of the Properties panel. In the Values list, add the instance
names of the three additional communication
componentsav_1_mc,
av_2_mc,
bandwidth_mcas shown in Figure 2-25.
 Save your document, and test the movie with both the Publish Preview
and Test Movie commands. If you have a web cam and microphone
connected to your computer, start streaming audio/video from one
Flash movie's AVPresence instance. You should then
see the same audio/video stream displayed in the other
movie's AVPresence instance. (Be careful and wear
headphones during these tests. If you use an open microphone and
regular speakers, you'll likely experience harsh
audio feedback.) Test different bit rate settings in the SetBandwidth
component to see how the quality changes in both the video and audio
output.
 |