Application.clearStreams()

Availability

Flash Communication Server MX 1.0.

Usage

application.clearStreams(streamPath)

Parameters

streamPath A string that indicates the URI of a stream.

Returns

A Boolean value of true if the stream at the specified path was deleted; otherwise, false. If using wildcard characters to clear multiple stream files, the method returns true only if all the streams matching the wildcard pattern were successfully deleted; otherwise it returns false.

Description

Method; clears recorded streams (FLV) files and MP3 files associated with the application instance. You can use this method to clear a single stream, all streams associated with the application instance, just those streams in a specific subdirectory of the application instance, or just those streams whose names match a specified wildcard pattern.

The streamPath parameter specifies the location and name of a stream, relative to the application's instance directory. You can include a slash (/) as a delimiter between directories in the path. The last element in the path can contain wildcard patterns (for example, a question mark [?] and an asterisk [*]) or a stream name. The application.clearStreams() method traverses the stream hierarchy along the specified path and clears all the recorded streams that match the given wildcard pattern. Specifying a slash clears all the streams associated with an application instance.

To clear MP3 files associated with the application instance, precede the path to the stream with mp3: (for example, mp3:/streamPath). By default, the application.clearStreams() method clears only recorded FLV streams. You can also explicitly clear only FLV streams by placing flv: before the stream path (for example, flv:/streamPath). See the following Example section for examples of clearing FLV and MP3 files.

The following examples show some possible values for the streamPath parameter:

If an application.clearStreams() method is invoked on a stream that is currently recording, the recorded file is set to length 0 (cleared), and the internal cached data is also cleared.

NOTE

 

You can also use the Server Management ActionScript API removeApp method to delete all the resources for a single instance.

Example

The following example clears all recorded streams:

function onApplicationStop(){
    application.clearStreams("/");
}

The following example clears all MP3 files from the application instance's /disco subdirectory:

function onApplicationStop(){
    application.clearStreams("mp3:/disco/*");
}