Version 2

    What is Red5?

    From their web page (http://www.red5.org):

    Red5 Media Server 1.0 delivers a powerful video streaming and multi-user solution to the ©Adobe ©Flash Player and other exciting client technologies. Based on Java and some of the most powerful open source frameworks, Red5 stands as a solid solution for business of all sizes including the enterprise.

     

    Red5 includes support for the latest multi-user API’s including NetConnection, NetStream and SharedObject’s while providing a powerful RTMP / Servlet implementation. In addition to support for the RTMP protocol, the application server has an embedded Tomcat Servlet container for JEE Web Applications. Application development draws additional benefits from the Spring Framework and Scope based event driven services.

     

    By using the Open Source Red5 Media Server, you are developing with a truly open and extensible platform that can be used in Video Conferences, Multi-User Gaming and Enterprise Application Software.

    The Red5 Media Server uses the Spring Framework as their application server and, until the release under JBoss AS 7 was quite problematic due to dependencies conflicts. JBoss AS 7 presents us with a new modular and OSGi compliant architecture that facilitates this integration.

     

    Creating the initial red5 EAR

    Prepare the stage

    1. AS 7 or higher (http://www.jboss.org/jbossas/downloads) – Only tested with Web Profile Only package
    2. 1.0 RC1 (WAR) - http://trac.red5.org/downloads/1_0/red5-war-1.0-RC1.zip
    3. JBoss AS 7 package
    4. JBOSS_HOME/standalone/deployments create the following directory structure:
      • red5.ear
        • META-INF
        • Red5.war

    Create the RED5.jar archive

    1. the downloaded red5-war-1.0-RC1.zip into a working directory
    2. it you’ll find a ROOT.war, unpack it’s contents into the directory called red5ear/red5.war
    3. the red5.ear/red5.war/WEB-INF/lib into red5.ear
    4. the directory red5.ear/red5.war/WEB-INF/classes/org into red5.jar
    5. the created red5.jar into red5.ear/lib
    6. the red5.ear/red5.war/WEB-INF/classes/org directory

    Create the red5-context.jar archive

    1. the following files in a file named red5-context.jar:
      • red5.ear/red5.war/WEB-INF/classes/beanRefContext.xml
      • red5.ear/red5.war/WEB-INF/classes/defaultContext.xml
      • red5.ear/red5.war/WEB-INF/classes/red5-common.xml
      • red5.ear/red5.war/WEB-INF/classes/red5-core.xml
    2. the created red5-context.jar to red5.ear/lib
    3. the following files:
      • red5.ear/red5.war/WEB-INF/classes/beanRefContext.xml
      • red5.ear/red5.war/WEB-INF/classes/defaultContext.xml
      • red5.ear/red5.war/WEB-INF/classes/red5-common.xml
      • red5.ear/red5.war/WEB-INF/classes/red5-core.xml

    Getting and deploying the installer application

    1. the installer directory from the SVN repository:
    2. the checked-out installer directory into red5.ear/red5.war
    3. red5.ear/red5.war/installer/WEB-INF/red5-web.xml to installer-web.xml and move it to red5.ear/red5.war/WEB-INF/classes
    4. the directory red5.ear/red5.war/installer/WEB-INF directory

    Getting and deploying the Vod web application

    1. the vod directory from the SVN repository:
    2. and rename the vod directory to red5.ear/vod.war
    3. directory red5.ear/vod.war/WEB-INF/classes
    4. red5.ear/vod.war/WEB-INF/red5-web.xml to vod-web.xml and move it to  red5.ear/vod.war/WEB-INF/classes
    5. red5.ear/vod.war/WEB-INF/red5-web.properties

    Create ear descriptors

    1. xml file red5.ear/META-INF/application.xml with the following contents:

    <?xml version="1.0" encoding="UTF-8"?>

    <application xmlns="http://java.sun.com/xml/ns/javaee"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"

    version="5">

     

    <display-name>red5</display-name>

     

    <module>

       <web>

         <web-uri>red5.war</web-uri>

         <context-root>/red5</context-root>

      </web>

    </module>

     

    <module>

      <web>

        <web-uri>vod.war</web-uri>

        <context-root>/red5/vod</context-root>

      </web>

    </module>

     

    </application>

     

    1. xml file red5.ear/META-INF/MANIFEST.MF with the following contents:

     

    Dependencies: org.apache.commons.logging export, org.slf4j export

     

    1. that the inserted line ends with a new line. This ensures that the last line in the manifest file will not be skipped.
    2. an alternative to the MANIFEST.MF file you can also use the following contents in a file named file red5.ear/META-INF/jboss-deployment-structure.xml

     

    <?xml version="1.0" encoding="UTF-8"?>

    <jboss-deployment-structure>

      <deployment>

        <dependencies>

          <module name="org.apache.commons.logging"/>

          <module name="org.slf4j"/>

        </dependencies>

      </deployment>

    </jboss-deployment-structure>

     

    Fix web.xml files

    Open red5.ear/red5.war/WEB-INF/web.xml and set the webAppRootKey to:

                    <context-param>

                                    <param-name>webAppRootKey</param-name>

                                    <param-value>/red5</param-value>

                    </context-param>

    Open red5.ear/vod.war/WEB-INF/web.xml and add the following context params:

                    <context-param>

                                    <param-name>globalScope</param-name>

                                    <param-value>default</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>parentContextKey</param-name>

                                    <param-value>default.context</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>contextConfigLocation</param-name>

                                    <param-value>WEB-INF/classes/*-web.xml</param-value>

                    </context-param>

     

                    <listener>

    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

                    </listener>

    set the webAppRootKey to:

                    <context-param>

                                    <param-name>webAppRootKey</param-name>

                                    <param-value>/red5/vod</param-value>

                    </context-param>

     

    Fix *-web.xml files

    Open red5.ear/red5.war/WEB-INF/classes/root-web.xml and change contextPath property to:

    <property name="contextPath" value="/" />

    Open red5.ear/red5.war/WEB-INF/classes/installer-web.xml remove the following:

                    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

                        <property name="location" value="/WEB-INF/red5-web.properties" />

                    </bean>

    and update the following tags to:

                    <bean id="installer-web.context" class="org.red5.server.Context" autowire="byType" />

     

                    <bean id="installer-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="installer-web.context" />

                                    <property name="handler" ref="installer-web.handler" />

                                    <property name="contextPath" value="/installer" />

                                    <property name="virtualHosts" value="*" />

                    </bean>

     

                    <bean id="installer-web.handler" class="org.red5.server.adapter.ApplicationAdapter" />

     

                    <bean id="installer.service" class="org.red5.server.service.Installer">

                                    <property name="applicationRepositoryUrl"

                                                       value="http://red5.googlecode.com/svn/snapshots/" />

                    </bean>

     

    Open red5.ear/vod.war/WEB-INF/classes/vod-web.xml remove the following:

                    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

                        <property name="location" value="/WEB-INF/red5-web.properties" />

                    </bean>

    and update the following tags to:

                    <bean id="vod-web.context" class="org.red5.server.Context" autowire="byType" />

     

                    <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="vod-web.context" />

                                    <property name="handler" ref="vod-web.handler" />

                                    <property name="contextPath" value="/vod" />

                                    <property name="virtualHosts" value="*" />

                    </bean>

     

                    <bean id="vod-web.handler" class="org.red5.server.adapter.ApplicationAdapter" />

     

    Deploy & test it

    • Start JBoss AS 7 by running the following command in a terminal:

    JBOSS_HOME/bin/standalone(.bat/.sh)

    • Deploy the red5.ear by creating an empty text  file named red5.ear.dodeploy in:

    JBOSS_HOME/standalone/deployments

    • If everything is well, you should now be able to point your browser to:

    http://localhost:8080/red5

    • And confirm that:
      1. VOD stream (Red5 intro video) is working
      2. install link starts the installer application and shows a list of application names to be installed (don’t install anything because it will not work).

     

     

    Add red5 installer war packages

    The following demo web applications can be downloaded by going into the Red5 installer and selecting the designated application. Once selected, click on the Install button and this will download the respective war file. These file will be available in JBOSS_HOME/standalone/deployments/red5.ear once downloaded.

    Shared Object web app

    • Install the SOSample web application
    • Rename the file to something else
    • Create directory SOSample.war
    • Extract contents of downloaded war into the SOSample.war directory
    • Rename red5.ear/SOSample.war/WEB-INF/red5-web.xml to sosample-web.xml
    • Move it to red5.ear/SOSample.war/WEB-INF/classes
    • Delete red5.ear/SOSample.war/WEB-INF/red5-web.properties

    Fix red5.ear/SOSample.war/WEB-INF/web.xml

    Open red5.ear/SOSample.war/WEB-INF/web.xml for editing and add the following:

                    <context-param>

                                    <param-name>globalScope</param-name>

                                    <param-value>default</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>parentContextKey</param-name>

                                    <param-value>default.context</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>contextConfigLocation</param-name>

                                    <param-value>WEB-INF/classes/*-web.xml</param-value>

                    </context-param>

     

                    <listener>

                                     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

                    </listener>

    set the webAppRootKey to:

                    <context-param>

                                    <param-name>webAppRootKey</param-name>

                                    <param-value>/red5/SOSample</param-value>

                    </context-param>

     

    Fix red5.ear/SOSample.war/WEB-INF/classes/sosample-web.xml

    Open red5.ear/SOSample.war/WEB-INF/classes/sosample-web.xml remove the following:

                    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

                        <property name="location" value="/WEB-INF/red5-web.properties" />

                    </bean>

    and update the following tags to:

                    <bean id="vod-web.context" class="org.red5.server.Context" autowire="byType" />

     

                    <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="vod-web.context" />

                                    <property name="handler" ref="vod-web.handler" />

                                    <property name="contextPath" value="/vod" />

                                    <property name="virtualHosts" value="*" />

                    </bean>

     

                    <bean id="vod-web.handler" class="org.red5.server.adapter.ApplicationAdapter" />

     

    Update application.xml

    Add the following tag to red5.ear/META-INF/application.xml:

      <module>

          <web>

    <web-uri>SOSample.war</web-uri>

    <context-root>/red5/SOSample</context-root>

        </web>

      </module>

     

    Test it

    • Start JBoss AS 7
    • Open two browser instances side-by-side and pointing to the following URL:

    http://localhost:8080/red5/demos/BallControl.html

    • In both pages, substitute the RTMP end-point to be:

    rtmp://localhost/red5/SOSample

    • In both pages, click on the blue plug icon to connect to the server
    • In any of the pages drag the Red5 logo and you should see it being also moved on the other page

     

     

    Echo web app

    • Install the echo web application
    • Rename the file to something else
    • Create directory echo.war
    • Extract contents of downloaded war into the echo.war directory
    • Rename red5.ear/echo.war/WEB-INF/red5-web.xml to echo-web.xml
    • Move it to red5.ear/echo.war/WEB-INF/classes
    • Delete red5.ear/echo.war/WEB-INF/red5-web.properties

    Fix red5.ear/echo.war/WEB-INF/web.xml

    Open red5.ear/echo.war/WEB-INF/web.xml for editing and add the following:

                    <context-param>

                                    <param-name>globalScope</param-name>

                                    <param-value>default</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>parentContextKey</param-name>

                                    <param-value>default.context</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>contextConfigLocation</param-name>

                                    <param-value>WEB-INF/classes/*-web.xml</param-value>

                    </context-param>

     

                    <listener>

    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

                    </listener>

    Remove the following entries:

        <filter>

    <filter-name>LoggerContextFilter</filter-name>

    <filter-class>org.red5.logging.LoggerContextFilter</filter-class>

        </filter>

     

        <listener>

            <listener-class>org.red5.logging.ContextLoggingListener</listener-class>

        </listener>

     

        <filter-mapping>

           <filter-name>LoggerContextFilter</filter-name>

    <url-pattern>/*</url-pattern>

        </filter-mapping>           

     

    Fix red5.ear/echo.war/WEB-INF/classes/echo-web.xml

    Open red5.ear/echo.war/WEB-INF/classes/echo-web.xml remove the following:

                    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

                        <property name="location" value="/WEB-INF/red5-web.properties" />

                    </bean>

    and update the following tags to:

        <bean id="echo-web.context" class="org.red5.server.Context"

            autowire="byType" />

     

        <bean id="echo-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="echo-web.context" />

            <property name="handler" ref="echo-web.handler" />

            <property name="contextPath" value="/echo" />

            <property name="virtualHosts" value="*" />

        </bean>

     

        <bean id="echo-web.handler" class="org.red5.demos.echo.Application" />

     

        <!-- enable support for mx:RemoteObject requests -->

        <bean id="flexMessaging.service" class="org.red5.server.net.remoting.FlexMessagingService">

            <property name="serviceInvoker" ref="global.serviceInvoker" />

            <!-- add an entry for all possible "destination" attributes of your

                 mx:RemoteObject sources -->

            <property name="endpoints">

                <map>

                    <entry key="Red5Echo">

                        <!-- object that handles requests sent to this endpoint -->

                        <ref bean="echo-web.handler" />

                    </entry>

                </map>

            </property>

        </bean>

    Update application.xml

    Add the following tag to red5.ear/META-INF/application.xml:

      <module>

          <web>

    <web-uri>echo.war</web-uri>

    <context-root>/echo</context-root>

        </web>

      </module>

     

    Test it

     

    Ofla demo web app

    • Install the oflaDemo web application
    • Rename the file to something else
    • Create directory oflaDemo.war
    • Extract contents of downloaded war into the oflaDemo.war directory
    • Rename red5.ear/oflaDemo.war/WEB-INF/red5-web.xml to oflaDemo-web.xml

    Fix red5.ear/oflademo.war/WEB-INF/web.xml

    Open red5.ear/oflaDemo.war/WEB-INF/web.xml for editing and add the following:

                    <context-param>

                                    <param-name>globalScope</param-name>

                                    <param-value>default</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>parentContextKey</param-name>

                                    <param-value>default.context</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>contextConfigLocation</param-name>

                                    <param-value>WEB-INF/classes/*-web.xml</param-value>

                    </context-param>

     

                    <listener>

    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

                    </listener>

    Remove the following entries:

        <listener>

    <listener-class>org.red5.logging.ContextLoggingListener</listener-class>

        </listener>

     

        <filter>

            <filter-name>LoggerContextFilter</filter-name>

    <filter-class>org.red5.logging.LoggerContextFilter</filter-class>

        </filter>

     

        <filter-mapping>

    <filter-name>LoggerContextFilter</filter-name>

    <url-pattern>/*</url-pattern>

        </filter-mapping>

    Fix red5.ear/oflademo.war/WEB-INF/classes/oflademo-web.xml

    Open red5.ear/oflaDemo.war/WEB-INF/classes/oflaDemo-web.xml remove the following:

                    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

                        <property name="location" value="/WEB-INF/red5-web.properties" />

                    </bean>

    and update the following tags to:

                    <bean id="oflaDemo-web.context" class="org.red5.server.Context"

                                    autowire="byType" />

     

                    <bean id="oflaDemo-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="oflaDemo-web.context" />

                                    <property name="handler" ref="oflaDemo-web.handler" />

                                    <property name="contextPath" value="/oflaDemo" />

                                    <property name="virtualHosts" value="*" />

                    </bean>

     

                    <bean id="oflaDemo-web.handler" class="org.red5.demos.oflaDemo.Application" />

    Update application.xml

    Add the following tag to red5.ear/META-INF/application.xml:

      <module>

          <web>

    <web-uri>oflaDemo.war</web-uri>

    <context-root>/oflaDemo</context-root>

        </web>

      </module>

     

    Test it

    • Start JBoss AS 7

     

     

    • Open browser instance in http://localhost:8080/red5/demos/publisher.html
    • Under setting click on Connect
    • Under the video tab, select a video device (e.g. web cam) and click on Start
    • Under the audio tab, select a audio device and click on Start
    • Click on Publish to start streaming video
    • Click on view tab and press on Play to subscribe to published streaming channel

     

     

    Fitc demo web app

    • Install the fitcDemo web application
    • Rename the file to something else
    • Create directory fitcDemo.war
    • Extract contents of downloaded war into the fitcDemo.war directory
    • Rename red5.ear/fitcDemo.war/WEB-INF/red5-web.xml to fitcDemo-web.xml

    Fix red5.ear/fitcdemo.war/WEB-INF/web.xml

    Open red5.ear/fitcDemo.war/WEB-INF/web.xml for editing and add the following:

                    <context-param>

                                    <param-name>globalScope</param-name>

                                    <param-value>default</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>parentContextKey</param-name>

                                    <param-value>default.context</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>contextConfigLocation</param-name>

                                    <param-value>WEB-INF/classes/*-web.xml</param-value>

                    </context-param>

     

                    <listener>

                                     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

                    </listener>

    Remove the following entries:

        <listener>

    <listener-class>org.red5.logging.ContextLoggingListener</listener-class>

        </listener>

     

        <filter>

    <filter-name>LoggerContextFilter</filter-name>

    <filter-class>org.red5.logging.LoggerContextFilter</filter-class>

        </filter>

     

        <filter-mapping>

    <filter-name>LoggerContextFilter</filter-name>

            <url-pattern>/*</url-pattern>

        </filter-mapping>

     

        <security-constraint>

            <web-resource-collection>

    <web-resource-name>Forbidden</web-resource-name>

    <url-pattern>/streams/*</url-pattern>

            </web-resource-collection>

    <auth-constraint/>

        </security-constraint>

    Fix red5.ear/fitcdemo.war/WEB-INF/classes/fitcdemo-web.xml

    Open red5.ear/fitcDemo.war/WEB-INF/classes/fitcDemo-web.xml remove the following:

                    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

                        <property name="location" value="/WEB-INF/red5-web.properties" />

                    </bean>

    and update the following tags to:

                    <bean id="fitcDemo-web.context" class="org.red5.server.Context"

                                    autowire="byType" />

     

                    <bean id="fitcDemo-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="fitcDemo-web.context" />

                                    <property name="handler" ref="fitcDemo-web.handler" />

                                    <property name="contextPath" value="/fitcDemo" />

                                    <property name="virtualHosts" value="*" />

                    </bean>

     

                    <bean id="fitcDemo-web.handler" class="org.red5.demos.fitc.Application" />

    Update application.xml

    Add the following tag to red5.ear/META-INF/application.xml:

      <module>

          <web>

    <web-uri>fitcDemo.war</web-uri>

    <context-root>/fitcDemo</context-root>

        </web>

      </module>

    Test it

    • Start JBoss AS 7

     

    • Open browser instance in http://localhost:8080/red5/demos/FITCPresentation.swf
    • Move to the “Demo – Video Conference” slide
    • Set the RTMP address to rtmp://localhost/fitcDemo
    • Click on blue plugs to connect to server
    • You should see your web camera stream once you accept access to it
    • Repeat above steps for a second web cam view

     

    Audio transcoder

    Before you start you need to get lib xuggle-xuggler.jar from Xuggler web site (http://xuggle.com/xuggler/red5) and copy it into red5.ear/lib directory.

     

    • Install the audiotranscoder web application
    • Rename the file to something else
    • Create directory audiotranscoder.war
    • Extract contents of downloaded war into the audiotranscoder.war directory
    • Create red5.ear/audiotranscoder.war/WEB-INF/classes directory
    • Rename red5.ear/audiotranscoder.war/WEB-INF/red5-web.xml to audiotranscoder-web.xml
    • Move audiotranscoder-web.xml to red5.ear/audiotranscoder.war/WEB-INF/classes

    Fix red5.ear/audiotranscoder.war/WEB-INF/web.xml

    Open red5.ear/audiotranscoder.war/WEB-INF/web.xml for editing and add the following:

                    <context-param>

                                    <param-name>globalScope</param-name>

                                    <param-value>default</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>parentContextKey</param-name>

                                    <param-value>default.context</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>contextConfigLocation</param-name>

                                    <param-value>WEB-INF/classes/*-web.xml</param-value>

                    </context-param>

     

                    <listener>

    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

                    </listener>

    Remove the following entries:

        <listener>

    <listener-class>org.red5.logging.ContextLoggingListener</listener-class>

        </listener>

     

        <filter>

    <filter-name>LoggerContextFilter</filter-name>

    <filter-class>org.red5.logging.LoggerContextFilter</filter-class>

        </filter>

     

        <filter-mapping>

            <filter-name>LoggerContextFilter</filter-name>

    <url-pattern>/*</url-pattern>

        </filter-mapping>

     

        <security-constraint>

            <web-resource-collection>

    <web-resource-name>Forbidden</web-resource-name>

    <url-pattern>/streams/*</url-pattern>

            </web-resource-collection>

            <auth-constraint/>

        </security-constraint>

    Fix red5.ear/audiotranscoder.war/WEB-INF/classes/audiotranscoder-web.xml

    Open red5.ear/audiotranscoder.war/WEB-INF/classes/audiotranscoder-web.xml remove the following:

                    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

                        <property name="location" value="/WEB-INF/red5-web.properties" />

                    </bean>

    and update the following tags to:

      <bean id="audiotranscoder-web.context" class="org.red5.server.Context" autowire="byType"/>

     

      <bean id="audiotranscoder-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="audiotranscoder-web.context"/>

        <property name="handler" ref="audiotranscoder-web.handler"/>

        <property name="contextPath" value="/audiotranscoder"/>

        <property name="virtualHosts" value="*"/>

      </bean>

     

      <bean id="audiotranscoder-web.handler"

    class="com.xuggle.red5.demo.AudioTranscoderDemoAdapter"

        init-method="init">

        <!-- Have the profiler spit out data every 15 seconds -->

        <property name="profilerFrequency" value="15"/>

      </bean>

    Update application.xml

    Add the following tag to red5.ear/META-INF/application.xml:

      <module>

          <web>

              <web-uri>audiotranscoder.war</web-uri>

              <context-root>/audiotranscoder</context-root>

        </web>

      </module>

    Test it

    Also see onther info at http://localhost:8080/audiotranscoder/index.html.

    • Start JBoss AS 7

     

     

    • On Server tab set Location to rtmp://localhost/audiotranscoder
    • Set Buffer to 0
    • Click on Connect to connect to rtmp server

     

    • On Audio tab set Device to your audio input device
    • Click on Start to init the input video device

     

    • On Publish tab set the Name to example
    • Click on Publish to start streaming

     

    • On View tab set Name to example
    • Click on Play to play the example stream and you should hear whatever is being streamed by your audio device.

     

    Test Xuggler

    • Click on Stop to end playing the stream
    • On the view tab, rename the stream to xuggle_example
    • Click on Play to play the on-the-fly modified stream and confirm that the audio is now being echoed.

     

     

    Video transcoder

    Before you start you need to get lib xuggle-xuggler.jar from Xuggler web site (http://xuggle.com/xuggler/red5) and copy it into red5.ear/lib directory.

     

    • Install the videotranscoder web application
    • Rename the file to something else
    • Create directory videotranscoder.war
    • Extract contents of downloaded war into the videotranscoder.war directory
    • Create red5.ear/videotranscoder.war/WEB-INF/classes directory
    • Rename red5.ear/videotranscoder.war/WEB-INF/red5-web.xml to videotranscoder-web.xml
    • Move audiotranscoder-web.xml to red5.ear/videotranscoder.war/WEB-INF/classes

    Fix red5.ear/videotranscoder.war/WEB-INF/web.xml

    Open red5.ear/videotranscoder.war/WEB-INF/web.xml for editing and add the following:

                    <context-param>

                                    <param-name>globalScope</param-name>

                                    <param-value>default</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>parentContextKey</param-name>

                                    <param-value>default.context</param-value>

                    </context-param>

     

                    <context-param>

                                    <param-name>contextConfigLocation</param-name>

                                    <param-value>WEB-INF/classes/*-web.xml</param-value>

                    </context-param>

     

                    <listener>

    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

                    </listener>

    Remove the following entries:

        <listener>

    <listener-class>org.red5.logging.ContextLoggingListener</listener-class>

        </listener>

     

        <filter>

    <filter-name>LoggerContextFilter</filter-name>

    <filter-class>org.red5.logging.LoggerContextFilter</filter-class>

        </filter>

     

        <filter-mapping>

    <filter-name>LoggerContextFilter</filter-name>

    <url-pattern>/*</url-pattern>

        </filter-mapping>

     

        <security-constraint>

            <web-resource-collection>

    <web-resource-name>Forbidden</web-resource-name>

    <url-pattern>/streams/*</url-pattern>

            </web-resource-collection>

            <auth-constraint/>

        </security-constraint>

    Fix red5.ear/videotranscoder.war/WEB-INF/classes/videotranscoder-web.xml

    Open red5.ear/videotranscoder.war/WEB-INF/classes/videotranscoder-web.xml remove the following:

                    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

                        <property name="location" value="/WEB-INF/red5-web.properties" />

                    </bean>

    and update the following tags to:

        <bean id="videotranscoder-web.context" class="org.red5.server.Context" autowire="byType"/>

     

      <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="videotranscoder-web.context"/>

        <property name="handler" ref="videotranscoder-web.handler"/>

        <property name="contextPath" value="/videotranscoder"/>

        <property name="virtualHosts" value="*"/>

      </bean>

     

      <bean id="videotranscoder-web.handler"

    class="com.xuggle.red5.demo.VideoTranscoderDemoAdapter"

        init-method="init">

        <!-- Have the profiler spit out data every 15 seconds -->

        <property name="profilerFrequency" value="15"/>

      </bean>

    Update application.xml

    Add the following tag to red5.ear/META-INF/application.xml:

      <module>

          <web>

    <web-uri>videotranscoder.war</web-uri>

              <context-root>/videotranscoder</context-root>

        </web>

      </module>

    Test it

    Instructions are also available at http://localhost:8080/videotranscoder/index.html.

    • Start JBoss AS 7

     

     

    • On Server tab set Location to rtmp://localhost/videotranscoder
    • Set Buffer to 0
    • Click on Connect to connect to rtmp server

     

    • On Video tab set Device to USB Video Device (or other)
    • Click on Start to init the input video device

     

    • On Audio tab set Device to your audio input device
    • Click on Start to init the input video device

     

    • On Publish tab set the Name to example
    • Click on Publish to start streaming

     

    • On View tab set Name to example
    • Click on Play to play the example stream and you should see whatever is being streamed by your video device.

    Test Xuggler

    • Click on Stop to end playing the stream
    • On the view tab, rename the stream to xuggle_example
    • Click on Play to play the on-the-fly modified stream and confirm that the video is now being mirrored into black-and-white.

     

    Resources

    Discussion thread at JBoss.org: http://community.jboss.org/message/617150#617150

    Ria Connection: http://riaconnection.wordpress.com/2011/07/15/jboss-as-7-and-red5-media-server/

    Downloable EAR file (from RIA Connection - rename file to red5.ear.7z and extract it): http://riaconnection.files.wordpress.com/2011/07/red57.doc

    Red5: http://www.red5.org/

    Xuggler: http://www.xuggle.com/xuggler/

     

     

    Kudos

    Bruno Santos

    Scott Kroll

    Marius Bogoevici