Red5 1.0 RC1 与tomcat 6 整合
1.0以上版本没整合成功过,如有人整合成功过,也分享下,在此先谢谢
一.下载red5-1.0.0-RC1.zip
下载地址: http://code.google.com/p/red5/ 和 http://red5.org/downloads/red5/1_0/
二.开始准备工作
解压red5-1.0.0-RC1.zip 为 red5-1.0.0-RC1 并解压里面的src.zip 为目录src
1.先在eclipse或者myeclipse创建web工程 名称为:red5 (名称随便取)
2.把red5-1.0.0-RC1下lib拷贝到web-inf下lib
3.拷贝src下org目录到red5工程下src下
4.拷贝src下conf下war下的配置文件到red5工程src下
5.修改配置文件red5-common.xml (这个版本可不做,如在1.0下要做这个的,但是没整合成功过,还是出现多个错误)
删除以下代码
<!-- JMX server --> <bean id="jmxFactory" class="org.red5.server.jmx.JMXFactory"> <property name="domain" value="org.red5.server"/> </bean> <bean id="jmxAgent" class="org.red5.server.jmx.JMXAgent" init-method="init"> <!-- The RMI adapter allows remote connections to the MBeanServer --> <property name="enableRmiAdapter" value="false"/> <property name="rmiAdapterPort" value="9999"/> <property name="rmiAdapterRemotePort" value=""/> <property name="rmiAdapterHost" value="127.0.0.1"/> <property name="enableSsl" value="false"/> <!-- Starts a registry if it doesnt exist --> <property name="startRegistry" value="false"/> <!-- Authentication --> <property name="remoteAccessProperties" value="access.properties"/> <property name="remotePasswordProperties" value="password.properties"/> <property name="remoteSSLKeystore" value=""/> <property name="remoteSSLKeystorePass" value=""/> <!-- Mina offers its own Mbeans so you may integrate them here --> <property name="enableMinaMonitor" value="false"/> </bean>
保存。
6.把red5-core.xml文件下的"@"符号全部用"${}"符号,并引入red5.properties
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="red5.properties" /> </bean>
7.在red5.properties的#rtmp下增加以下代码
rtmp.event_threads_core=16 rtmp.event_threads_max=32 rtmp.io_threads=16 rtmp.connect_threads=4 rtmp.send_buffer_size=271360 rtmp.receive_buffer_size=65536
8.把配置文件下的web.xml替换web-inf下的web.xml
并@webapp.root.key@ 替换为red5
9.logback.xml把<consolePlugin/>删除
10.整合完成。
以下整合示例oflaDemo
这个得用安装好oflaDemo示例,可参考网上教程,安装red5
然后拷贝webapps目录下oflaDemo
反编译下oflaDemo下web-inf下的class
后把反编辑的文件放入上面red5工程下的src下
1.把oflaDemo下的所有文件除了(web-inf和META-INF)拷贝到red5 的webRoot(myeclipse)下
2.修改red5工程下src下red5-web.properties
context.path=/red5 virtual.hosts=*,localhost, localhost\:8080, 127.0.0.1\:8080
并拷贝到web-inf下
3.修改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> <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="/WEB-INF/red5-web.properties" /> </bean> <!-- ROOT web context --> <bean id="web.context" class="org.red5.server.Context" autowire="byType"> <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="${context.path}" /> <property name="virtualHosts" value="${virtual.hosts}" /> </bean> <bean id="web.handler" class="org.red5.demos.oflaDemo.Application" /> </beans>
4.修改webRoot下的index.html
把里面'streamer': 'rtmp://localhost/oflaDemo' 修改为以下
<script type='text/javascript'> jwplayer('mediaspace').setup({ 'flashplayer': 'player.swf', 'file': 'hobbit_vp6.flv', 'streamer': 'rtmp://localhost:1935/red5', 'controlbar': 'bottom', 'width': '848', 'height': '360' }); </script>
rtmptrtmptrtmptrtmpt协议的还未配置,进一步学习
5.部署tomcat启动
就可以看到结果了
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="/WEB-INF/red5-web.properties" /> </bean> <!-- ROOT web context --> <bean id="web.context" class="org.red5.server.Context" autowire="byType"> <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="${context.path}" /> <property name="virtualHosts" value="${virtual.hosts}" /> </bean> <bean id="web.handler" class="org.red5.demos.oflaDemo.Application" /> </beans>