Robin Bultot (Woedend!) wrote:
> 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
>
>
>
>   

You dont need this

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

take out the getStreamDirectory there, call a publish on the client like 
publish("thestreamname","record");

for instance and it should start showing up in the dir. 

    }




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

Reply via email to