
Chapter 476
Application.onDisconnect
The server calls the
application.onDisconnect method when the NetConnection is closed.
You cannot use
client.call on the object being passed inside onDisconnect. However, you can
send a message to all other clients about this event:
// On the server side you would have the following
application.onConnect = function(newClient, name)
{
newClient.name = name;
return true;
}
application.onDisconnect = function(client)
{
for (var i = 0; i < application.clients.length; i++)
{
application.clients[i].call("userDisconnects", client,name);
}
}
// On the client side you would have the following
nc = new NetConnection();
nc.userDisconnects= function (name) {
trace(name + "quits");
}
nc.connect ("rtmp:/app_name", userName);
Camera object
This section includes recommendations to help you optimize your use of the Camera object,
including tips for matching camera settings to available bandwidth and using one camera in
multiple applications.
Turning the camera off
If your application uses a Camera object attached to a NetStream object to record data, the
camera will stay on after you finish recording. To turn off the camera, use
NetStream.attachVideo(false) when you have finished recording.
Suggested settings for different bandwidth speeds
The default camera settings provide a good viewing experience for all bandwidth settings.
However, you can experiment with different settings for different bandwidths.
The code for setting the camera settings is as follows:
my_cam = Camera.get();
my_cam.setQuality(bandwidthSpeed,quality)
Use the following table as a starting point if you want to experiment with camera settings at
different bandwidth speeds.
Bandwidth Effect Code
Modem Lower image quality, higher motion quality my_cam.setQuality(4000,0)
Higher image quality, lower motion quality my_cam.setQuality(0,65)
DSL Lower image quality, higher motion quality my_cam.setQuality(12000,0)
Commenti su questo manuale