Here in “jar” target we have copied the created jar file inside our application directory
under webapps folder of Red5 installation. One can manually do the copy paste.
Note: - Don’t forget to add red5 libraries from Red5lib folder into your eclipse so that it
can compile the application.
Step4:- Now we will create our source file. Create a java file, name it to Application.java
The sample application file will be like –
Application.java
package org.xyz;
//log4j classes
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
//Red5 classes
import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IClient;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
/**This is the sample application class */
public class Application extends ApplicationAdapter{
/**Variable used for generating the log*/
private static final Log log = LogFactory.getLog(Application.class);
/**This method will execute when Red5 server will start*/
public boolean appStart(IScope app){
if(super.appStart(app) == false){
return false;
}
log.info("Application start method of Application called");
return true;
}
/**This method will execute when first client will connect to Red5 server*/
public boolean roomStart(IScope room){
if(super.roomStart(room) == false){
return false;
}
log.info("Inside room start of Application");
return true;
}
/**This method will execute everytime when a client will connect to Red5 server*/
public boolean roomConnect(IConnection conn, Object params[]){
if(super.roomConnect(conn, params) == false){
return false;
}
log.info("Inside room connect method of Application");
return true;
}
/**This method will be called when a client disconnect from the room*/
public void roomDisconnect(IConnection conn){
super.roomDisconnect(conn);
log.info("Inside room disconnect method of Application");
}
/**This method will be called when a client will be disconnected from application*/
public void appDisconnect(IConnection conn){
log.info("Inside app disconnect method of Application");
}
/**This method will be called from the client. This method will show “Hello World!” on
*the flash client side .
*/
public String sayHello(Object[] params){
log.info(“I got your name:-”+params[0].toString());
return “Hello World!” + params[0].toString();
}
} ////////End of Application class
We hope the information helped you. If you have any questions
or comments, please don't hesitate to post them on the
Forums section Submit your Tutorial at Click Here