red5 get default stream file absolute path

These days i has been fell into Red5 program. The Red5 Application will save live stream in the default path – /webapps/yourAppName/streams. Of couse, we can change the default path to custom directories. Check here Streaming from custom directories for more details.

I am a lazy boy, moreover, the default path works fine. But i need to do some transcoding between flv and mp3. So i must get the saved file absolute path. Below is my code for getting the path.

Email me or leave a message when you find a better way!!



import ...;

public class Application extends MultiThreadedApplicationAdapter{
  public String getDefaultStreamPath(IScope scope, String name) throws IOException{
    IStreamFilenameGenerator generator = (IStreamFilenameGenerator) ScopeUtils.getScopeService(scope, IStreamFilenameGenerator.class, DefaultStreamFilenameGenerator.class);
    String recordingFilename = generator.generateFilename(scope, name, ".flv", GenerationType.RECORD);
    File file = scope.getContext().getResource(recordingFilename).getFile();
    return file.getAbsolutePath().replace("", "\");  // Windows path