Macromedia flash media server 2-client-side actionscript language reference for flash media server 2 User Manual
12
Client-Side ActionScript Language Reference
Camera.bandwidth
Availability
■
Flash Player 6.
■
Flash Media Server (not required).
Usage
public bandwidth : Number [read-only]
Description
Property (read-only); an integer that specifies the maximum amount of bandwidth the current
outgoing video feed can use, in bytes. A value of 0 means that Flash Video can use as much
bandwidth as needed to maintain the desired frame quality.
outgoing video feed can use, in bytes. A value of 0 means that Flash Video can use as much
bandwidth as needed to maintain the desired frame quality.
To set this property, use
Example
The following example changes the maximum amount of bandwidth used by the camera feed.
Create a new video instance by selecting New Video from the Library options menu. Add an
instance to the Stage and give it the instance name
Create a new video instance by selecting New Video from the Library options menu. Add an
instance to the Stage and give it the instance name
my_video
. Add a NumericStepper
component instance to the Stage and give it the instance name
bandwidth_nstep
. Then add
the following ActionScript to Frame 1 of the Timeline:
var bandwidth_nstep:mx.controls.NumericStepper;
var my_video:Video;
var my_cam:Camera = Camera.get();
my_video.attachVideo(my_cam);
this.createTextField("bandwidth_txt", this.getNextHighestDepth(), 0, 0,
var my_video:Video;
var my_cam:Camera = Camera.get();
my_video.attachVideo(my_cam);
this.createTextField("bandwidth_txt", this.getNextHighestDepth(), 0, 0,
100, 22);
bandwidth_txt.autoSize = true;
this.onEnterFrame = function() {
bandwidth_txt.text = "Camera is currently using "+my_cam.bandwidth+"
this.onEnterFrame = function() {
bandwidth_txt.text = "Camera is currently using "+my_cam.bandwidth+"
bytes ("+Math.round(my_cam.bandwidth/1024)+" KB) bandwidth.";
};
//
bandwidth_nstep.minimum = 0;
bandwidth_nstep.maximum = 128;
bandwidth_nstep.stepSize = 16;
bandwidth_nstep.value = my_cam.bandwidth/1024;
function changeBandwidth(evt:Object) {
my_cam.setQuality(evt.target.value/1024, 0);
}
bandwidth_nstep.addEventListener("change", changeBandwidth);
//
bandwidth_nstep.minimum = 0;
bandwidth_nstep.maximum = 128;
bandwidth_nstep.stepSize = 16;
bandwidth_nstep.value = my_cam.bandwidth/1024;
function changeBandwidth(evt:Object) {
my_cam.setQuality(evt.target.value/1024, 0);
}
bandwidth_nstep.addEventListener("change", changeBandwidth);