Red5 and FMS features in comparison
Following are few of the functions and properties of RED5 and FMS in comparison. In most of the aspects you will find Red5 to be slightly more complicated but far more powerful than Flash Media Server. The Red5 Team is working on bring around SSAS (Server side actionscript) to actionscript programmers who may not be very fond of java. Its expected to come put with the first grand release of Red5 ‘s version 1.0.
Some FMS Handler Functions | Equivalent Red 5 Handler Functions | Comment |
application.onAppStart() | appStart() | Executed by server when a application starts. |
application.onAppStop() | appStop() | Executed by server when a application stops. |
application.onConnect() | appConnect() | Executed by server when a client connects to the application. |
application.onDisconnect() | appDisconnect() | Executed by server when a client disconnects from the application. |
application.onPublish() | streamPublishStart() | Executed by server when a stream starts publishing to server. Note that publishing may be live / record. |
Few FMS Features | Equivalent Red 5 Features | Comment |
application.hostname | IConnection conn = Red5.getConnectionLocal();conn.getHost(); | Gets the host name that the RTMP connection is made to |
application.name | IConnection conn = Red5.getConnectionLocal();conn.getPath(); | Gets the application name(fms) / path(path) by the RTMP connection url. |
Client.id | IConnection conn = Red5.getConnectionLocal();conn.getClient().ID; | Gets client id to uniquely identify client |
Client.ip | Connection conn = Red5.getConnectionLocal();conn.getRemoteAddress(); | Gets client IP address |
NA | Connection conn = Red5.getConnectionLocal();conn.getRemotePort(); | Gets client port |
The Red5 Application Class:
The Core class or the Application class in Red5 is your entry point into red5. This is where your flash client meets the server. The application class typically extends ApplicationAdapter or the
MultiThreadedApplicationAdapter (in the new api).
A Sample application class with info
package com.flashvisions.red5server;
import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.IClient;
import org.red5.server.api.Red5;
import org.red5.server.api.stream.IBroadcastStream;
import org.red5.server.api.stream.ISubscriberStream;
import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.IClient;
import org.red5.server.api.Red5;
import org.red5.server.api.stream.IBroadcastStream;
import org.red5.server.api.stream.ISubscriberStream;
public class Application extends ApplicationAdapter
{
// executed when client disconnects
public synchronized void disconnect(IConnection conn, IScope scope) {
super.disconnect(conn, scope);
}
// executed when application starts
public synchronized boolean appStart(IScope app) {
return super.appStart(app);
}
// executed when client connects
public synchronized boolean connect(IConnection conn, IScope scope, Object[] params) {
return super.connect(conn, scope, params);
}
// executed when application stops
public synchronized void appStop(IScope app) {
super.appStop(app);
}
// executed when client connects to application
public synchronized boolean appConnect(IConnection conn, Object[] params)
{
return super.appConnect(conn, params);
}
// executed when client disconnects from application
public synchronized void appDisconnect(IConnection conn)
{
super.appDisconnect(conn);
}
// executed when client starts publishing a stream to application (live / record)
public synchronized void streamPublishStart(IBroadcastStream stream) {
super.streamPublishStart(stream);
}
// executed when client starts publishing a stream to application in record mode
public synchronized void streamRecordStart(IBroadcastStream stream) {
super.streamRecordStart(stream);
}
{
// executed when client disconnects
public synchronized void disconnect(IConnection conn, IScope scope) {
super.disconnect(conn, scope);
}
// executed when application starts
public synchronized boolean appStart(IScope app) {
return super.appStart(app);
}
// executed when client connects
public synchronized boolean connect(IConnection conn, IScope scope, Object[] params) {
return super.connect(conn, scope, params);
}
// executed when application stops
public synchronized void appStop(IScope app) {
super.appStop(app);
}
// executed when client connects to application
public synchronized boolean appConnect(IConnection conn, Object[] params)
{
return super.appConnect(conn, params);
}
// executed when client disconnects from application
public synchronized void appDisconnect(IConnection conn)
{
super.appDisconnect(conn);
}
// executed when client starts publishing a stream to application (live / record)
public synchronized void streamPublishStart(IBroadcastStream stream) {
super.streamPublishStart(stream);
}
// executed when client starts publishing a stream to application in record mode
public synchronized void streamRecordStart(IBroadcastStream stream) {
super.streamRecordStart(stream);
}
You application class can be more complicated than this depending on your requirements.
Thank you very much for your great summary!!!