Could you explain how to use it?

I've tried it with the code below, but it doesn't work. I don't know 
where to use it.
I'm very new to red5, sorry for the simple questions.

[code]
package org.red5.server.webapp.oflaDemo;

import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.stream.IServerStream;
import org.red5.server.api.stream.IStreamCapableConnection;
import org.red5.server.api.stream.IStreamFilenameGenerator;
import org.red5.server.api.stream.support.SimpleBandwidthConfigure;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

public class Application extends ApplicationAdapter implements 
IStreamFilenameGenerator {
    private IScope appScope;
    private IServerStream serverStream;

    @Override
    public boolean appStart(IScope app) {
        appScope = app;
        getStreamDirectory(appScope);       
        return true;
    }

    @Override
    public boolean appConnect(IConnection conn, Object[] params) {
        // Trigger calling of "onBWDone", required for some FLV players
        measureBandwidth(conn);
        if (conn instanceof IStreamCapableConnection) {
            IStreamCapableConnection streamConn = 
(IStreamCapableConnection) conn;
            SimpleBandwidthConfigure sbc = new SimpleBandwidthConfigure();
            sbc.setMaxBurst(8*1024*1024);
            sbc.setBurst(8*1024*1024);
            sbc.setOverallBandwidth(2*1024*1024);
            streamConn.setBandwidthConfigure(sbc);
        }
        return super.appConnect(conn, params);
    }
   
    private String getStreamDirectory(IScope scope) {
        return "StreamsTest/";
    }
  
    public String generateFilename(IScope scope, String name) {
        return generateFilename(scope, name, null);
    }

    public String generateFilename(IScope scope, String name, String 
extension) {
        String result = getStreamDirectory(scope) + name;
            DateFormat date = new SimpleDateFormat("yyyyMMdd");
            String appendDate = date.format(new Date());
            result += "_" + appendDate;
      
        if (extension != null && !extension.equals(""))
            result += extension;
        return result;
    }

    @Override
    public void appDisconnect(IConnection conn) {
        if (appScope == conn.getScope() && serverStream != null) {
            serverStream.close();
        }
        super.appDisconnect(conn);
    }
}
[/code]

Thanks, in advance,

Robin Bultot



Dan Rossi wrote:
> Robin Bultot (Woedend!) wrote:
>> I'm trying hard to understand the simple recorder example..
>> The strange thing is that I can't find the line where it says record to 
>> "oflaDemo/streams"
>>
>> It looks there is allmost nothing in the Application.java for 
>> configuring the recording?
>>
>>   
> Hi you need to implement the IStreamFilenameGenerator class
>
> then add a method like
>
> private String getStreamDirectory(IScope scope) {
>
>         //return "E:\\CamsArchive\\";
>         //log.info("Calling archivePath property " + this.archivePath);
>         //log.info("Calling interal private var someVar " + this.someVar);
>         //return !archivePath.equals("") ? archivePath : "CamsArchive/";
>         return "CamsArchive/";
>     }
>    
>     public String generateFilename(IScope scope, String name) {
>         return generateFilename(scope, name, null);
>     }
>
>     public String generateFilename(IScope scope, String name, String 
> extension) {
>        
>
>        
>         String result = getStreamDirectory(scope) + name;
>        
>         //if (!archiveFileDateFormat.equals(""))
>         //{
>             //log.info(archiveFileDateFormat);
>             //DateFormat date = new 
> SimpleDateFormat(archiveFileDateFormat);
>             DateFormat date = new SimpleDateFormat("yyyyMMdd");
>             String appendDate = date.format(new Date());
>             result += "_" + appendDate;
>     //    }
>        
>         if (extension != null && !extension.equals(""))
>             result += extension;
>         return result;
>     }
>
>
> as you can see im still trying a way to use config settings for the 
> path, however the config setup is poxy and requires alot of fiddling 
> with web.xml, red5.properties and setter methods, even after that 
> those methods were not even able to get the settings. im not an expert 
> with spring so once i work that out ill post it.
> ------------------------------------------------------------------------
>
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
>   

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

Reply via email to