javastreamingred5

Cannot connect to red5 application


Trying to write a red5 application that simply records everything that gets streamed to it. Found a project template from here that I loosely followed.

If I connect to rtmp://myserverip/live (from the default install) from FMLE 3.2, everything works ok. If I connect to rtmp://myserverip/video I get the error

"Problem with Primary Server. Failure to connect to primary server. Please verify that your server URL and application name are valid and that your Internet connection is working and retry."

I have code as follows:

Application

    public class Application extends ApplicationAdapter {


    /** {@inheritDoc} */ 
    @Override
    public boolean connect(IConnection conn, IScope scope, Object[] params) { 
            super.connect(conn, scope, params);
        return true; 
    } 

    /** {@inheritDoc} */ 
    @Override
    public void disconnect(IConnection conn, IScope scope) { 
        super.disconnect(conn, scope);
    } 

    @Override
    public void streamPublishStart(IBroadcastStream stream) { 
            super.streamPublishStart(stream);
        try { 
            stream.saveAs(stream.getPublishedName(), false); 
        } 
        catch (Exception e) { 
            e.printStackTrace(); 
        } 
    } 

    @Override
    public void streamBroadcastClose(IBroadcastStream stream) { 
            super.streamBroadcastClose(stream);
        System.out.print("Broadcast Closed"); 
    } 
    @Override
    public void streamBroadcastStart(IBroadcastStream stream) { 
            super.streamBroadcastStart(stream);
        System.out.print("Broadcast Started"); 
    } 
}

web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app 
   xmlns="http://java.sun.com/xml/ns/j2ee" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
   version="2.4"> 

    <display-name>video</display-name>

    <context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>/video</param-value>
    </context-param>

</web-app>

red5-web.xml

   <?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:lang="http://www.springframework.org/schema/lang"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd                            
    http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.0.xsd">

    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value="/WEB-INF/red5-web.properties" />
    </bean>

    <bean id="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="web.context" />
        <property name="handler" ref="web.handler" />
        <property name="contextPath" value="${webapp.contextPath}" />
        <property name="virtualHosts" value="${webapp.virtualHosts}" />
    </bean>

    <bean id="web.handler" class="net.bordereastcreative.video.Application" />

</beans>

red5-web.properties

webapp.contextPath=/video
webapp.virtualHosts=*

Any idea as to what I'm doing wrong? I looked in all the log files in /usr/share/red5/log but I cannot see anything pertaining to this app.

Using Ubuntu LTS 12.04 and red5 1.0.

UPDATE #1: edited code to add calls to super and virtualhosts changed to just *.


Solution

  • The easiest way to record all your streams automatically, server-wide is to set the auto record property "broadcaststream.auto.record" in the red5.properties file