Hi,
I'm using CustomFilenameGenerator to create a custom record stream
(/home/streams/) and I try to keep a full path scope to for path.
For example if i'm record stream with this url :
rtmp://my_server/my_appliation/room1/room3/  i'll have
:/home/streams/room1/room2/myStream.flv.
Unfortunately it seems that it doesn't work, here is my
CustomFilenameGenerator class. Any idea ?

package actusite.recorder;

import org.red5.server.api.IScope;
import org.red5.server.api.ScopeUtils;
import org.red5.server.api.stream.IStreamFilenameGenerator;


public class CustomFilenameGenerator implements IStreamFilenameGenerator {

       /** Path that will store recorded videos. */
    public String recordPath = "/home/streams/";

    public void setRecordPath(String path) {
        recordPath = path;
    }

    private String getStreamDirectory(IScope scope) {
        final StringBuilder result = new StringBuilder();
        final IScope app = ScopeUtils.findApplication(scope);
        while (scope != null && scope != app) {
            result.insert(0, scope.getName() + "/");
            scope = scope.getParent();
        }
        return result.toString();
    }

    public String generateFilename(IScope scope, String name,
            GenerationType type) {
        // Generate filename without an extension.
        return generateFilename(scope, name, null, type);
    }

    public String generateFilename(IScope scope, String name, String
extension, GenerationType type) {
        String filename;
            filename = recordPath + getStreamDirectory(scope) + name;
        if (extension != null)
            // Add extension
            filename += extension;
        return filename;
    }

}

Thanks

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to