User Guide

The NetStream class 51
Then, in the corresponding server-side ActionScript, you would add the following code in the
main.asc file:
application.onAppStart = function(){
trace("::: Application has started :::");
}
application.onConnect = function(client){
application.acceptConnection(client);
// Add methods
client.prototype.sendInfo = function(name) {
var slen = Stream.length(name);
trace("slen: " + slen);
return slen;
};
}
About buffering a stream
For playback streams, the value returned by the NetStream.bufferTime property specifies
how much of the stream Flash Media Server will buffer before Flash Player starts playing it
back. For example, if your recorded stream is 50 seconds long and your playback speed is
twice as fast as your download speed, you might consider setting this value to 25 seconds. You
will thus be able to play all of the stream without any stalls.
For publishing streams, this value specifies how long the outgoing queue can grow before
Flash Player considers dropping messages; to determine how much data is currently in the
queue, use
NetStream.bufferLength. For a fast connection, the value returned by
NetStream.bufferLength will never approach the value of NetStream.bufferTime, but on
a slow connection it might.
Therefore, if you know your application is running over a slow connection and you want to
minimize dropped messages or stalled playback, you might want to use the
NetStream.setBufferTime() method to increase the value of NetStream.bufferTime.
About the play status of a stream
The NetStream.onPlayStatus event handler is invoked when a NetStream object has
completely played a stream. The information object that’s passed to the callback function
gives extra information when a NetStream object has switched from one stream to another
stream in a playlist (
NetStream.Play.Switch) or when a NetStream object has played to the
end (
NetStream.Play.Complete). If you want to respond to this event handler, you must
create a function to process the information object sent by the server.