The SetBandwidth Communication UI Component

Now that the Video objects are ready, we're going to add one more UI component to control the quality of the video. The SetBandwidth component lets the user optimize the quality of the camera and microphone streams by defining the bandwidth that is available to them. There are three preset bandwidth settings (LAN, DSL, and MODEM) that you can edit in the Properties window. These names make reference to the upload and download speeds available to you. There is also a custom setting that lets the user tweak the bandwidth.

Selecting a Modem setting allows (by default) a 33 kilobit per second (kBps) stream to be received and a 33kBps stream to be sent over the connection. Let's step through the process of adding the SetBandwidth UI component:

  1. Drag a SetBandwidth UI component from the Components panel to the stage.

  2. Name it bandwidth_mc in its Properties panel.

  3. Select the SimpleConnect box, and then add these three new video components and the bandwidth component to the list of Flash Communication Components. When you are finished, the Values window should now look like Figure 4.5.

    Figure 4.5. Your SimpleConnect Values window should now contain all the video components.


When you are ready to test the application, make sure your multimedia gear is plugged in, installed, and working. It is a good idea to turn down your speakers or headphones before you launch this application. If your testing environment has microphones and speakers too close together, you will get audio feedback. You should also make sure your camera is not being used by another application (like the Yahoo! Messenger). If it is, the Flash player will not be able to connect with it.

When ready, select Control, Test Movie. Log into the application. You will see the three video windows you placed on the stage, but no video will appear (see Figure 4.6).

Figure 4.6. The AVPresence component waiting for a user to publish to it.


Each AVPresence component requires a user to select a video window to publish to. When you click on a window, the Flash player displays a privacy window requesting permission to access your camera and microphone.

This always happens when any Flash movie tries to access these devices. Macromedia has placed this privacy feature directly into Flash Player 6 to ensure your privacy is protected (see Figure 4.7). There will be more detail on this window and how you can manage it in Chapter 12, "Client-Side (Flash) ActionScript."

Figure 4.7. The Flash player Privacy window.


Click Allow at this prompt to continue.

Your camera and microphone will now be enabled, and you should immediately see yourself, or whatever your camera is pointing at, in the AVPresence window. If your microphone is connected, talk into it. You should see the Flash Audio meter registering your voice.

On Computer B, have a friend access the application and enable its video camera and microphone. At this point, you should see through each camera on each computer, just like Figure 4.8. With your microphones, you should now hear each other through the speakers or headphones.

Figure 4.8. The myFirstApp Communication Application showing two video sources and a great conversation.


If you are having sound problems such as feedback or no sound, check all your connections and make sure your windows volume control is set properly. You can also adjust your microphone and other settings by right-clicking on the Flash Application (Mac OS: Ctrl+click). Select the Microphone tab. Chapter 12 will explain all settings that can be controlled with Flash Player 6.

The AVPresence component has other features including the capability to pause video feed and mute audio feed. Roll over the video window that contains your video feed (see Figure 4.9).

Figure 4.9. Icons appear when you roll over the window of your camera. These icons stop the publishing stream, muting your presence to everyone.



A note about the streams: Each AVPresence component consumes a one-way stream. If all three video windows are being used, each Flash player will be handling three streams in total. If you are sending (or publishing) your stream, you only consume one stream. There is no limit to the number of streams you can have per Communication Server. Your only limitation is bandwidth. For example, 3 streams at DSL speed (256/kBps) would consume 768kBps (3x256) or three-quarters of 1MB. Understanding the bandwidth available to you is very important.

When you do this, you will see three icons within that window:

  • The (x) icon stops publishing your video feed and frees up the AVPresence component for another user to connect.

  • The Camera icon pauses your video publishing, but still allows you to transmit audio. This means that everyone connected will see a still "snapshot" of the last frame captured.

  • The Microphone icon mutes your audio. These icons directly affect the publication of your stream and affect everyone receiving the stream. Muting your microphone does not affect your video feed.

On Computer B, use your mouse to roll over the Video window showing someone else's video. Two icons will appear, the Camera icon and the Microphone icon. Click these icons to pause receiving their video feed or mute their audio feed. Either of these icons will only affect the stream coming to your computer; it will not have an affect on the publisher nor anyone else connected. Other people in the communication will retain their live feeds.

    Part I: 10 Quick Steps for Getting Started