Passing configuration parameters into Red5 application
Often your Red5 project may need some external variable to be passed into Red5 application as a part of your configuration data, such that its not hard coded into the red5 application and you can change it as and when needed. For example : A database name, a configuration file path etc etc
Here we will demonstrate two ways to pass configuration data into Red5 application.
- Though red5-web.xml directly
- Through red5.properties routed via red5.xml
Passing parameters through red5-web.xml
This is the first method used to pass configuration data into your red5 application. In this example we will pass variable into the main application class.
import org.red5.server.Scope;
import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.service.ServiceUtils;
public class Application extends ApplicationAdapter {
public String database = "mydb.sqlite";
/** {@inheritDoc} */
@Override
public boolean appStart(IScope scope) {
return true;
}
@Override
public boolean connect(IConnection conn, IScope scope, Object[] params) {
return true;
}
@Override
public void disconnect(IConnection conn, IScope scope) {
super.disconnect(conn, scope);
}
public void setDatabase(String dbname)
{
database = dbname;
}
}
Note the last function: setDatabase this is the public setter function which will set the value of the variable database. Now the second part of this process is sending value to this function from outside Red5. For that we will be usingt the Red5 bean configuration file - red5-web.xml
So now we will edit the red5-web.xml file at the application’s bean handler definition and add the the variable property to it.
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!--
Defines a properties file for dereferencing variables
-->
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="/WEB-INF/red5-web.properties" />
</bean>
<!--
Defines the web context
-->
<bean id="web.context" class="org.red5.server.Context"
autowire="byType" />
<!--
Defines the web scopes
-->
<bean id="web.scope" class="org.red5.server.WebScope"
init-method="register">
<property name="server" ref="red5.server" />
<property name="parent" ref="global.scope" />
<property name="context" ref="web.context" />
<property name="handler" ref="web.handler" />
<property name="contextPath" value="${webapp.contextPath}" />
<property name="virtualHosts" value="${webapp.virtualHosts}" />
</bean>
<!--
Defines the web handler which acts as an applications endpoint
-->
<bean id="web.handler" class="org.red5.core.Application" singleton="true">
<property name="database" value="mydb.sqlite"/>
</bean>
</beans>
Note the application bean definition to see how the database property is passed into the application bean handler to the public setter function
<property name="database" value="mydb.sqlite"/>
</bean>
At this stage it is important to note of the setter function is named:
public function setDatabase, like in the following format
setVariablename. The variable name is camel-cased along with the word”set”
Popularity: 4% [?]
May 1, 2011
·
admin ·
One Comment
Posted in: Java, Red5
IPhone Alarm Fails In New Year – Big Time Glitch!!
A glitch is iPhone’s alarm system managed to slow down the new year for many iPhone users, as they overslept due to a failure in the IOS 4 alarm system. Its a pity that as devices get more and more complex, manufacturers fail to make even the simplest things perfectly. Apple has said that a fix is in work.
This is the second incident, after apple products were found to have the most number of security flaws declaring it to be the world leader in security flaws. While the mac community continues to plow at Adobe’s Flash platform, at every given opportunity, i Products are starting to prevail manufacturing defects, at a steady pace. Read more about it at  New York Times.
Popularity: 8% [?]
January 4, 2011
·
admin ·
2 Comments
Tags: Apple · Posted in: Commercial, iPhone
Introducing server-less live streaming system based on RTMFP!!
We are extremely happy to say, Web Media Live Encoder now supports RTMFP as well as RTMP protocols. On that we have created a small but heavy duty system based on RTMFP multicasting. You can create your own channel and broadcast as much as you like.. Â and its server-less!! Read the rest of this post »
Popularity: 24% [?]
December 9, 2010
·
admin ·
19 Comments
Tags: Actionscript 3.0, Flash, Flash Media Server, Flash Player 10.1, RTMFP, Streaming, Video · Posted in: Actionscript 3.0, Advertising, Php, RTMFP
Simple P2P Multicast Stream Player
Introducing the very first P2P multi-cast stream player. This player is free to use for developers and users. Experience the power of flash player 10.1, broadcast live video/audio without any server.
Stay tuned as next week we will be releasing an update on Web Media Live Encoder, which will enable you to setup your own server-less P2P broadcasting solution Read the rest of this post »
Popularity: 23% [?]
November 12, 2010
·
admin ·
133 Comments
Tags: Actionscript 3.0, Flash Player 10.1, reusable, RTMFP, Streaming, Video · Posted in: Actionscript 3.0, RTMFP



