msgbartop
Various ramblings-on, mostly about Red5
msgbarbottom

15 Jun 09 Quartz schedulers

When you want to schedule a particular task or job within Red5, you have at least two options available which are built into the server. We use Quartz for our scheduler, but you are not required to use it; I just wanted to get that disclaimer out of the way, this is Java so use whatever you like.  The first option is the “server-wide” scheduler which is created when the server starts up and requires no configuration from your application. This scheduler is sufficient for most of the jobs you may want to create, but you will run into problems if you attempt to access an application class from within your job. The second option resolves this issue by providing an application level scheduler, one which can access your classes. The only caveat with this scheduler is that you must provide some configuration details, your applications context name.

Accessing the “server-wide” scheduler is done in your application like so (using scope):

schedulingService = (ISchedulingService) scope.getContext().getBean(ISchedulingService.BEAN_NAME);

Accessing the application scheduler is slightly different (using app context):

schedulingService = (ApplicationSchedulingService) ((BeanFactory) applicationContext).getBean("scheduler");

I prefer to make sure the schedulingService member is setup in my “appStart” method, since this is essentially where the application is “started” within Red5.

The following entry must be made in your applications red5-web.xml file if you want to use an application scheduler:

<bean id="scheduler" class="org.red5.server.scheduling.ApplicationSchedulingService">
    <property name="applicationName" value="myapp" />
</bean>

Make sure you set the correct application name / context (replace “myapp”).
Once you have the scheduling service, you can add your job amongst many other options which I don’t want to cover here.

Tags: , , , , , ,

Buzz it!

06 Jun 09 PHP support in Red5

I’ve updated my “parameterdemo” to include a couple PHP pages. The latest trunk (0.8.1-dev) now supports PHP through the use of Quercus. To enable it simply set a context parameter in your web.xml and include the quercus and resin-utils jars in your WEB-INF/lib. See the zip file for a complete example (eclipse + ant).

Once you deploy the war, go to these urls to test (update your port to match your servers setting):

PHP example getting value from Red5 application: 

<a href="http://localhost/parameterdemo/getparam.php">http://localhost/parameterdemo/getparam.php</a>

Same example with debug output: 

<a href="http://localhost/parameterdemo/getparam.php?debug=true">http://localhost/parameterdemo/getparam.php?debug=true</a>

Java servlet example: 

<a href="http://localhost/parameterdemo/myservlet">http://localhost/parameterdemo/myservlet</a>

The web.xml entry must look like so:

	<context-param>
	   <param-name>enable-php</param-name>
	   <param-value>true</param-value>
	</context-param>

Tags: , , , , ,

Buzz it!

06 Jun 09 FFMPEG made super simple

Robert and Art continue to amaze me with their Xuggler project. If you are like me and have had to use FFMPEG in a project (Java in my case), you know how hard it can be to get everything working correctly. Xuggler has some how made this even more easy than with their 1.0 version. Through the use of their MediaTool you can do some incredible stuff; the stuff that should have been possible with JMF! Do yourself a favor and check out their post about the MediaTool.

As a minor side note, Xuggler has changed its license to AGPL with the 3.0 release.

Tags: , , , ,

Buzz it!

05 Jun 09 Red5 0.8.0 released

Come one, come all.. Red5 0.8.0 is now available. Make your way to our google code page and download the installer for your platform. http://code.google.com/p/red5/

PS. If someone wants to build the Debian package, we are looking for a volunteer.

Tags: , ,

Buzz it!

03 Jun 09 Multiple HTTP socket configurations

Red5 version 0.8.0 introduces the ability to bind multiple ports and hosts for HTTP access; starting at revision 3632. Previously there were other options to accomplish this feature, but now it is built-in. So I’ll get right to it. The older configuration style for the tomcat server bean was like so:

<bean id="tomcat.server" class="org.red5.server.tomcat.TomcatLoader" init-method="init" destroy-method="shutdown" depends-on="context.loader">
	<property name="webappFolder" value="${red5.root}/webapps" />
	<property name="connector">
		<bean class="org.apache.catalina.connector.Connector">
			<constructor -arg type="java.lang.String" value="org.apache.coyote.http11.Http11NioProtocol" />
			<property name="port"><value>${http.port}</value></property>
			<property name="redirectPort"><value>${https.port}</value></property>
			<property name="enableLookups"><value>false</value></property>
		</bean>
	</property>
	<property name="baseHost">
		<bean class="org.apache.catalina.core.StandardHost">
			<property name="name" value="${http.host}" />
			<property name="unpackWARs" value="true" />
			<property name="autoDeploy" value="true" />
			<property name="xmlValidation" value="false" />
			<property name="xmlNamespaceAware" value="false" />
		</bean>
	</property>
</bean>

This allowed for one connector (port) and one host (like www.red5.org). If http.host were set to “192.168.0.1″ and http.port was set to “5080″, then you would be able to connect to “http://192.168.0.1:5080/” in your browser.
This latest configuration still supports this configuration, but allows for much more.

<bean id="tomcat.server" class="org.red5.server.tomcat.TomcatLoader" init-method="init" destroy-method="shutdown" depends-on="context.loader">
	<property name="webappFolder" value="${red5.root}/webapps" />
	<property name="connectors">
		<list>
			<bean id="defaultHttp" class="org.apache.catalina.connector.Connector">
				<constructor -arg type="java.lang.String" value="org.apache.coyote.http11.Http11NioProtocol" />
				<property name="port"><value>${http.host}</value></property>
				<property name="redirectPort"><value>8080</value></property>
				<property name="enableLookups"><value>false</value></property>
			</bean>
			<bean id="defaultProxy" class="org.apache.catalina.connector.Connector">
				<constructor -arg type="java.lang.String" value="org.apache.coyote.http11.Http11NioProtocol" />
				<property name="port"><value>8080</value></property>
				<property name="redirectPort"><value>${https.port}</value></property>
				<property name="enableLookups"><value>false</value></property>
			</bean>
		</list>
	</property>
	<property name="baseHost">
		<bean class="org.apache.catalina.core.StandardHost">
			<property name="name" value="${http.host}" />
			<property name="unpackWARs" value="true" />
			<property name="autoDeploy" value="true" />
			<property name="xmlValidation" value="false" />
			<property name="xmlNamespaceAware" value="false" />
		</bean>
	</property>
	<property name="hosts">
		<list>
			<bean id="local2" class="org.apache.catalina.core.StandardHost">
				<property name="name" value="192.168.0.2" />
				<property name="autoDeploy" value="false" />
				<property name="xmlValidation" value="false" />
				<property name="xmlNamespaceAware" value="false" />
			</bean>
			<bean id="local3" class="org.apache.catalina.core.StandardHost">
				<property name="name" value="10.0.0.2" />
				<property name="autoDeploy" value="false" />
				<property name="xmlValidation" value="false" />
				<property name="xmlNamespaceAware" value="false" />
			</bean>
		</list>
	</property>
</bean>

This allows for two connector (ports on each host) and three hosts. If http.host were set to “192.168.0.1″ and http.port was set to “5080″, then you would be able to connect to “http://192.168.0.1:5080/” in your browser. In addition you would also have these urls available:

  • http://192.168.0.1:8080/
  • http://192.168.0.2:5080/
  • http://192.168.0.2:8080/
  • http://10.0.0.2:5080/
  • http://10.0.0.2:8080/

Each application (context) within your red5/webapps directory is made available on each host as well.
Lastly, the “host” name does not have to be an IP address; you can specify a valid dns host name instead.

Tags: , , , ,

Buzz it!
10,964 spam comments
blocked by
Akismet