Monday 18 June 2007

videoStream quality settings

 activeCamera .setQuality( bandwidth ,  frameQuality )

Method; sets the maximum amount of bandwidth per second or the required picture quality of the current outgoing video feed.

The following code allows you to see the effects of setQuality(). You can include it on the main timeline of a Flash file in which you have placed a Video object named content_vid and NumericStepper components named cnsQuality and cnsBandwidth on stage:




var user_cam = Camera.get( );
// Display the video in the Video object.
content_vid.attachVideo(user_cam);
// Set the loopback so that you can view the compressed video.
user_cam.setLoopback(true);
var qualityListener = new Object( );
qualityListener.change = function (event) {
user_cam.setQuality(user_cam.bandwidth, event.target.value);
};
cnsQuality.addEventListener("change", qualityListener);
cnsQuality.minimum = 0;
cnsQuality.maximum = 100;
cnsQuality.value = user_cam.quality;
var bandwidthListener = new Object( );
bandwidthListener.change = function (event) {
user_cam.setQuality(event.target.value, user_cam.quality);
};
cnsBandwidth.addEventListener("change", bandwidthListener);
cnsBandwidth.minimum = 0;
cnsBandwidth.maximum = 400000;
cnsBandwidth.stepSize = 1000;
cnsBandwidth.value = user_cam.quality;


setLoopback(true) displays the stream in the preview as compressed, and requires a lot of processor power (compiling and decompiling at the same time), and there for only recommended for development and testing purposes.

KeyFrames:
By default Flash publishes a stream with a keyFrame every 15 frames. You can adjust this with:

user_cam.setKeyFrameInterval(10);

whether you set the parameter in setMode to true or false defines whether you want to give the frameRate priority or not; default settings are(160,120,15)

//(width,height,frameRate,frameRatePriority)
user_cam.setMode(320, 240, 25, true);

No comments: