Flash Media Server |
|||
| Server-Side ActionScript Language Reference > Server-Side ActionScript Language Reference > Stream class > Stream.length() | |||
Flash Communication Server MX 1.0.
myStream.length(name[,virtualKey])
name Name of a recorded stream (FLV) file or MP3 file. To get the length of an MP3 file, precede the name of the file with mp3: (for example, "mp3:beethoven").
virtualKey A string indicating a key value. Starting with Flash Media Server 2, stream names are not always unique; you can create multiple streams with the same name, place them in different physical directories, and use the VirtualDirectory section and VirtualKeys section of the vhost.xml file to direct clients to the appropriate stream. Because the Stream.length() method is not associated with a client, but connects to a stream on the server, you may need to specify a virtual key to identify the correct stream. For more information about keys, see Client.virtualKey. This parameter is optional.
The length of a recorded stream file or MP3 file in seconds.
Method (static); returns the length of a recorded stream file or MP3 file in seconds. If the requested file is not found, the return value is 0.
The following example gets the length of the recorded stream file myVideo and assigns it to the variable streamLen:
function onProcessCmd(cmd){
var streamLen = Stream.length("myVideo");
trace("Length: " + streamLen + "\n");
}
The following example gets the length of the MP3 file beethoven.mp3 and assigns it to the variable streamLen:
function onProcessCmd(cmd){
var streamLen = Stream.length("mp3:beethoven");
trace("Length: " + streamLen + "\n");
}