栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Red5搭建直播平台,spring集成kafka的原理

Red5搭建直播平台,spring集成kafka的原理

public boolean appStart(IScope app)

{

log.info(“oflaDemo appStart”);

System.out.println(“oflaDemo appStart”);

this.appScope = app;

return true;

}

public boolean appConnect(IConnection conn, Object[] params)

{

log.info(“oflaDemo appConnect”);

measureBandwidth(conn);

if ((conn instanceof IStreamCapableConnection)) {

IStreamCapableConnection streamConn = (IStreamCapableConnection)conn;

}

return super.appConnect(conn, params);

}

public void appDisconnect(IConnection conn)

{

log.info(“oflaDemo appDisconnect”);

if ((this.appScope == conn.getScope()) && (this.serverStream != null)) {

this.serverStream.close();

}

super.appDisconnect(conn);

}

}

5.2,增加所需要的jar文件spring-aop-3.0.5.RELEASE.jar和aopalliance-1.0.jar

6,重启Red5,访问路径http://localhost:5080/demos/ofla_demo.html,点击Connect,右侧变绿,出现播放列表。选择播放文件。

7,使用jwplayer,进行测试,书写代码如下

Loading the player...

jwplayer(“myElement”).setup({

file: “rtmp://localhost/oflaDemo/9.flv”,

height: 360,

image: “${pageContext.request.contextPath}/images/button.gif”,

width: 640

});

正常播放则测试成功。

8,进行二次开发

8.1,先写Java类

package first;

import org.red5.server.adapter.ApplicationAdapter;

import org.red5.server.api.IConnection;

import org.red5.server.api.IScope;

import org.red5.server.api.stream.IServerStream;

import org.red5.server.api.stream.IStreamCapableConnection;

public class Application extends ApplicationAdapter

{

private IScope appScope;

private IServerStream serverStream;

public Application()

{

}

public boolean appStart(IScope app)

{

this.appScope = app;

return true;

}

public boolean appConnect(IConnection conn, Object[] params)

{

measureBandwidth(conn);

if ((conn instanceof IStreamCapableConnection)) {

IStreamCapableConnection streamConn = (IStreamCapableConnection)conn;

}

return super.appConnect(conn, params);

}

public void appDisconnect(IConnection conn)

{

if ((this.appScope == conn.getScope()) && (this.serverStream != null)) {

this.serverStream.close();

}

super.appDisconnect(conn);

}

}

8.2 配置red5-web.properties,内容如下

webapp.contextPath=/red58

webapp.virtualHosts=*

8.3 配置red5-web.xml

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”

xmlns:lang="http://www.springfr

《一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义》

【docs.qq.com/doc/DSmxTbFJ1cmN1R2dB】 完整内容开源分享

amework.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">

8.4 配置web.xml

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”>

red58

webAppRootKey

/red58

rtmpt org.red5.server.net.rtmpt.RTMPTServlet

1

rtmpt

/fcs/*

rtmpt

/open/*

rtmpt

/close/*

rtmpt

/send/*

rtmpt

/idle/*

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/582252.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号