2013-08-25 108 views
0

試圖編寫一個red5應用程序,該應用程序只記錄所有流式傳輸到它的應用程序。找到一個here的項目模板,我鬆了一口氣。無法連接到red5應用程序

如果我連接到來自FMLE 3.2的rtmp://myserverip/live(來自默認安裝),一切正常。如果我連接到rtmp://myserverip/video,我得到錯誤

「主服務器出現問題。未能連接到主服務器。請驗證您的服務器URL和應用程序名稱是否有效,並且您的Internet連接正在工作並重試。

我有代碼如下:

應用

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=* 

任何想法,我做錯了什麼?我查看了/usr/share/red5/log中的所有日誌文件,但我看不到與此應用程序有關的任何內容。

使用Ubuntu LTS 12.04和red5 1.0。

更新#1:編輯的代碼添加到超級和虛擬主機的調用更改爲只*。

+0

你從每個你的方法缺少一個重大的事情重寫是對超級方法的調用。如果你沒有實現所有需要的邏輯,你必須調用super。 –

+0

Thanks @Mondain,我會添加這些並重新編譯。 –

+0

@Mondain,增加了對超級方法的調用,重新編譯並再次嘗試。沒有運氣。 –

回答

1

自動記錄你所有的數據流的最簡單方法,服務器範圍是設置在red5.properties自動記錄屬性「broadcaststream.auto.record」文件

+0

我在red5-common.properties文件中看到了這個東西。你可以添加一個示例XML節點,並指出你正在談論的.properties文件位於哪個目錄?我發現red5文檔非常缺乏。 –

+0

它位於這裏的文本道具文件中:red5/conf/red5.properties通常它是該文件中的最後一行 –

0

輸出日誌在啓動時會說什麼?

我們應該看到您的範圍正在創建的指示。

此外,嘗試減少虛擬主機到一個單一的通配符'*',看看是否有一些未定義的主機分辨率。

+0

您是否在談論red5.sh的啓動或應用程序本身的啓動?我查看/日誌中的每個日誌文件,但沒有提及任何地方的應用程序。 –

+0

將虛擬主機更改爲「*」。至今沒有任何改變。 –

0

您是否創建了有效的服務器端腳本,並將WEB-INF floder放入red5應用程序文件夾內的視頻文件夾中?

+0

我用上面的文件創建了一個eclipse項目,在我的red5/webapps文件夾中創建了一個名爲video的文件夾,並將我的項目中的WEB-INF文件夾上傳到創建的視頻文件夾。我假設「有效的服務器端腳本」是應用程序類? –

相關問題