MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Dokumentacja Strona 132

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 369
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 131
Chapter 454
Managing bandwidth
You can control the amount of data the server sends to each client by providing an approximate
bandwidth capacity. There are a few ways to do so. One way is to configure the capacity for the
Flash Communication Server in the configuration file (Config.xml). For more information on
this technique, see Managing Flash Communication Server. Another way is to use
NetStream.receiveVideo to specify the frame rate per second of the incoming video (the
default value is the frame rate of the movie). A third way to match the data flow with capacity is
to use
Camera.setQuality on the client side and Client.setBandwidthLimit on the server
side to inform the server of the client’s capacity. This technique is illustrated in the following
sample.
The code in the doc_bandwidth.fla file allows the user to choose between different bandwidth
settings. On the client side, the microphone and camera settings are updated according to the
user’s selection. On the server side, the bandwidth limit is updated. You can find the sample file
for this code in the flashcom_help\help_collateral\doc_bandwidth directory under the installed
Macromedia Flash MX authoring directories.
To see this application in action, create a directory named doc_bandwidth in your flashcom
application directory, then open doc_bandwidth.swf. See “Creating your working environment”
on page 31 if you want to re-create the sample.
The client-side ActionScript provides the interface for the user to choose between three settings:
Modem, DSL, or LAN. There are three buttons on the stage, which when selected return 1 for a
modem setting, 2 for a DSL setting, or 3 for a LAN setting. When the user changes the
bandwidth limit choice, the camera and microphone settings are updated. Because this change is
barely noticeable, extra code in the
updateBandwidth function also changes the screen size based
on the settings chosen.
_root.Modem_btn.onPress = function() {
// Call updateBandwidth to change
// camera and mic settings and inform
// the server
_root.updateBandwidth(1);
}
_root.DSL_btn.onPress = function() {
_root.updateBandwidth(2);
}
_root.LAN_btn.onPress = function() {
_root.updateBandwidth(3);
}
On the first frame of the FLA file, you can find the following code, which initializes the camera
and microphone, plays the stream from the server, and updates the camera and microphone
settings based on the user’s choices.
Przeglądanie stron 131
1 2 ... 127 128 129 130 131 132 133 134 135 136 137 ... 368 369

Komentarze do niniejszej Instrukcji

Brak uwag