0 0

RED5集成到tomcat,通过外网访问流媒体服务器中的视频时出错10

这是最近在项目中遇到的问题,以前一直在内网测试,效果良好,自从公司租了租了服务器后,需要通过外网访问,之后问题就接二连三的来了

通过将red5项目集成到tomcat中,然后访问red5服务器中的视频文件时,一直访问不到

现在有一个外网,例如为:183.54.223.123   对应内网为:10.52.85.21

在tomcat中的webapps中,有一个fileList编写的red5服务程序
在fileList 下的WEB-INF/classes中存在一些.xml配置文件,其中需要改变的主要是root-web.xml和red5-core.xml
以下是我的配置文件:

root-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
	 
	<!-- ROOT web context -->
	<bean id="web.context" class="org.red5.server.Context">
		<property name="scopeResolver" ref="red5.scopeResolver" />
		<property name="clientRegistry" ref="global.clientRegistry" />
		<property name="serviceInvoker" ref="global.serviceInvoker" />
		<property name="mappingStrategy" ref="global.mappingStrategy" />
	</bean>
	
	<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="global.handler" />
		<property name="contextPath" value="/fileList" />
		<property name="virtualHosts" value="10.52.85.21" />
	</bean>
	
	<bean id="web.handler" class="com.apps.Application" singleton="true" />
		
	<bean id="streamService.service" class="com.services.StreamService" singleton="true"/>
	
	<bean id="streamFilenameGenerator"
		class="streamfile.path.PathBean">
		<property name="recordPath" value="/usr/tmp/streams/" />
		<property name="playbackPath" value="/usr/tmp/streams/" />
	</bean>
</beans>

 

red5-core.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-2.5.xsd
	http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd">
	<!-- This context holds all the networking: mina -->

        .......省略部分......
	
	<!-- RTMP Mina Transport -->
	<bean id="rtmpTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
		<property name="ioHandler" ref="rtmpMinaIoHandler" />
        <property name="connectors">
            <list>
                <bean class="java.net.InetSocketAddress">
                    <constructor-arg index="0" type="java.lang.String" 
                                      value="10.52.85.21" />  
                    <constructor-arg index="1" type="int" value="1935" />  
                </bean>
            </list>
        </property>		
		<property name="receiveBufferSize" value="65536" />
		<property name="sendBufferSize" value="271360" />
        <property name="connectionThreads" value="4" />
        <property name="ioThreads" value="16" />
		<!-- This is the interval at which the sessions are polled for stats. If mina monitoring is not
				enabled, polling will not occur. -->
		<property name="jmxPollInterval" value="1000" />
		<property name="tcpNoDelay" value="true" />
	</bean>
	
        ......省略部分......

</beans>

 

在root-web.xml中指定了流媒体服务器中的文件播放路径-->/usr/tmp/streams,同时我也在此目录下放置了test.flv文件

看其中的IP地址,我这里很疑惑,到底是填写内网地址呢还是外网地址

根据tomcat中的日志red5.log中记录,当使用外网地址时,使用netstat -ntl | more命令查看时,发现1935根本不会开启,同时red5.log中就会出现cannot assign requested address错误
当使用内网时,就不会报错,并且使用命令查看端口时,发现1935是开启的

但是无论通过哪种方法访问 rtmp://183.54.223.123/fileList/test.flv  或者使用 rtmp://10.52.85.21/fileList/test.flv 都不能正常播放
在外部用流媒体播放器是无法播放的,总是说不是指定路径,于是我将一个自己写的测试流媒体播放的播放器放置在项目的tomcat下,通过内部区访问,也是行不通的,同时给我标出的端口竟然是80(如Server not found rtmp://183.54.223.123:80/fileList),证明我不是通过1935访问的(但是在这种情况下,如果上面中的xml文件配置的是内网IP的话,1935应该是打开了的,为什么竟然是通过80端口访问的呢?)

于是我又想是不是外网服务器进入内网中时,有一层防火墙,阻止了1935端口开启,但是打电话去问时,给我的答案是只对80端口进行了部分限制,其它的端口没有限制,同时我使用telnet命令在windows上是能够测通的

这里我已经确认了本机上的防火墙已经把特定的端口开启了,而且我也做过吧防火墙全部关闭过的尝试,但是都没有效果

所以在此特求各位懂的朋友指明一下,谢谢~~~

 

下面就是fileList中的具体文件图片:



 

 

  • 大小: 18.8 KB

1个答案 按时间排序 按投票排序

0 0

通过http://183.54.223.123:8080/fileList访问页面选择进入ofla_demo的目录,里面有测试地址,输入rtmp://183.54.223.123/fileList,查看连接是否成功,查看日志

2014年9月11日 10:55

相关推荐

Global site tag (gtag.js) - Google Analytics