尝试编写一个 red5 应用程序,它只记录流式传输到它的所有内容。从这里找到了一个我松散地遵循的项目模板。
如果我rtmp://myserverip/live
从 FMLE 3.2 连接到(从默认安装),一切正常。如果我连接到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:编辑代码以添加对超级和虚拟主机的调用更改为 *.