The NetStream class
This section includes recommendations for optimizing your use of the NetStream class,
including tips on incorporating data into a stream, managing a stream's buffer, and executing
code when a stream has finished playback.
Using multiple data types in a stream
In addition to streaming audio and video, you can include data, such as a text message, in a
stream. To add multiple data types to a stream, use the following method:
NetStream.send()
Getting the stream time length with ActionScript
If you are buffering your streams, you can use the
the number of seconds currently in the buffer. Sometimes, however, you may want to get the
total length of a stream. Flash Player doesn't have this information, but Flash Media Server
does; the server has a
to the server.
You can use client-side ActionScript such as the following to request the stream length:
function getInfo(){
nc.call("sendInfo", new MyResultSetName(), myStream);
}
function MyResultSetName(){
this.onResult = function(retVal){
_root.streamlength = retVal;
};
this.onStatus = function(info){
trace("Level: " + info.level + "
// process error object
};
}
50
Using Media Classes
property that the client can request through a message
Stream.length
NetStream.bufferLength
Code: " +
info.code);
property to get
Need help?
Do you have a question about the FLASH MEDIA SERVER 2-DEVELOPING MEDIA and is the answer not in the manual?
Questions and answers