0
点赞
收藏
分享

微信扫一扫

流媒体传输知识整理(五)

沪钢木子 2022-12-07 阅读 85

基于red5框架的RTMP协议流媒体数据传输
服务器端代码设计
(1) 主程序类:Application.java

public class Application extends ApplicationAdapter {
private static final Logger LOGGERgetLogger(Application.class);
/**
*
* @author linfenliang
* @date 2012-11-23
* @version V1.0.0
* @param args
* void

*/
public static void main(String[] args) {
// TODO Auto-generated method stub

}


public String test(String val) {
LOGGER.info("test called on: " + getName());
return val + val;
}

public String getit(String value){
LOGGER.info("flex调用成功,传入的参数: " + value);
return value+":"+UUID.randomUUID().toString().toUpperCase();
}
@Override
public synchronized boolean connect(IConnection conn, IScope scope,
Object[] params) {
LOGGER.info("---------connect---------");
return super.connect(conn, scope, params);
}


@Override
public synchronized void disconnect(IConnection conn, IScope scope) {
// TODO Auto-generated method stub
LOGGER.info("..........disconnect.........");
super.disconnect(conn, scope);
}


@Override
public synchronized boolean join(IClient client, IScope scope) {
LOGGER.info("---------join---------");
return super.join(client, scope);
}


@Override
public synchronized void leave(IClient client, IScope scope) {
LOGGER.info("---------leave---------");
super.leave(client, scope);
}


@Override
public synchronized boolean start(IScope scope) {
LOGGER.info(".........start.......");
return super.start(scope);
}


@Override
public synchronized void stop(IScope scope) {
LOGGER.info("---------stop---------");
super.stop(scope);
}

(2) 配置文件(WEB-INF目录下)
red5-web.prperties

webapp.contextPath=/Red5Test
webapp.virtualHosts=*, localhost, localhost:8088, 127.0.0.1:8088

red5-web.xml

<?xmlversion="1.0" encoding="UTF-8" ?>
<beansxmlns="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">

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

<beanid="web.context" class="org.red5.server.Context" autowire="byType" />

<beanid="web.scope" class="org.red5.server.scope.WebScope" init-method="register">
<propertyname="server" ref="red5.server" />
<propertyname="parent" ref="global.scope" />
<propertyname="context" ref="web.context" />
<propertyname="handler" ref="web.handler" />
<propertyname="contextPath" value="${webapp.contextPath}" />
<propertyname="virtualHosts" value="${webapp.virtualHosts}" />
</bean>

<beanid="web.handler" class="com.sides.red5.app.Application" />

</beans>

举报

相关推荐

0 条评论