增加hookip设置, 是否开启自动配置设置
parent
fe09511aed
commit
3c8507daee
|
@ -36,6 +36,9 @@ public class ZLMRunner implements CommandLineRunner {
|
||||||
@Value("${media.wanIp}")
|
@Value("${media.wanIp}")
|
||||||
private String mediaWanIp;
|
private String mediaWanIp;
|
||||||
|
|
||||||
|
@Value("${media.hookIp}")
|
||||||
|
private String mediaHookIp;
|
||||||
|
|
||||||
@Value("${media.port}")
|
@Value("${media.port}")
|
||||||
private int mediaPort;
|
private int mediaPort;
|
||||||
|
|
||||||
|
@ -51,6 +54,9 @@ public class ZLMRunner implements CommandLineRunner {
|
||||||
@Value("${server.port}")
|
@Value("${server.port}")
|
||||||
private String serverPort;
|
private String serverPort;
|
||||||
|
|
||||||
|
@Value("${media.autoConfig}")
|
||||||
|
private boolean autoConfig;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ZLMRESTfulUtils zlmresTfulUtils;
|
private ZLMRESTfulUtils zlmresTfulUtils;
|
||||||
|
|
||||||
|
@ -61,8 +67,7 @@ public class ZLMRunner implements CommandLineRunner {
|
||||||
MediaServerConfig mediaServerConfig = getMediaServerConfig();
|
MediaServerConfig mediaServerConfig = getMediaServerConfig();
|
||||||
if (mediaServerConfig != null) {
|
if (mediaServerConfig != null) {
|
||||||
logger.info("zlm接入成功...");
|
logger.info("zlm接入成功...");
|
||||||
logger.info("设置zlm...");
|
if (autoConfig) saveZLMConfig();
|
||||||
saveZLMConfig();
|
|
||||||
mediaServerConfig = getMediaServerConfig();
|
mediaServerConfig = getMediaServerConfig();
|
||||||
storager.updateMediaInfo(mediaServerConfig);
|
storager.updateMediaInfo(mediaServerConfig);
|
||||||
}
|
}
|
||||||
|
@ -91,12 +96,15 @@ public class ZLMRunner implements CommandLineRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveZLMConfig() {
|
private void saveZLMConfig() {
|
||||||
String hookIP = sipIP;
|
logger.info("设置zlm...");
|
||||||
if (mediaIp.equals(sipIP)) {
|
if (StringUtils.isEmpty(mediaHookIp)) {
|
||||||
hookIP = "127.0.0.1";
|
mediaHookIp = sipIP;
|
||||||
|
}
|
||||||
|
if (mediaIp.equals(mediaHookIp)) {
|
||||||
|
mediaHookIp = "127.0.0.1";
|
||||||
}
|
}
|
||||||
|
|
||||||
String hookPrex = String.format("http://%s:%s/index/hook", hookIP, serverPort);
|
String hookPrex = String.format("http://%s:%s/index/hook", mediaHookIp, serverPort);
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put("api.secret",mediaSecret); // -profile:v Baseline
|
param.put("api.secret",mediaSecret); // -profile:v Baseline
|
||||||
param.put("ffmpeg.cmd","%s -fflags nobuffer -rtsp_transport tcp -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s");
|
param.put("ffmpeg.cmd","%s -fflags nobuffer -rtsp_transport tcp -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s");
|
||||||
|
|
|
@ -93,6 +93,7 @@ public class PlayController {
|
||||||
lockFlag = false;
|
lockFlag = false;
|
||||||
logger.info("流编码信息已获取");
|
logger.info("流编码信息已获取");
|
||||||
JSONArray tracks = mediaInfo.getJSONArray("tracks");
|
JSONArray tracks = mediaInfo.getJSONArray("tracks");
|
||||||
|
logger.info(tracks.toJSONString());
|
||||||
streamInfo.setTracks(tracks);
|
streamInfo.setTracks(tracks);
|
||||||
storager.startPlay(streamInfo);
|
storager.startPlay(streamInfo);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,20 +1,24 @@
|
||||||
spring:
|
spring:
|
||||||
|
# [不需要改]
|
||||||
application:
|
application:
|
||||||
name: iot-vmp-vmanager
|
name: iot-vmp-vmanager
|
||||||
# 影子数据存储方式,支持redis、jdbc,暂不支持mysql
|
# [不需要改] 影子数据存储方式,支持redis、jdbc,暂不支持mysql,
|
||||||
database: redis
|
database: redis
|
||||||
# 通信方式,支持kafka、http
|
# [不需要改] 通信方式,支持kafka、http
|
||||||
communicate: http
|
communicate: http
|
||||||
|
# REDIS数据库配置
|
||||||
redis:
|
redis:
|
||||||
# Redis服务器IP
|
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1
|
||||||
host: 127.0.0.1
|
host: 192.168.1.141
|
||||||
#端口号
|
# [必须修改] 端口号
|
||||||
port: 6379
|
port: 6379
|
||||||
|
# [可选] 数据库 DB
|
||||||
database: 6
|
database: 6
|
||||||
#访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接
|
# [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接
|
||||||
password:
|
password: 4767cb971b40a1300fa09b7f87b09d1c
|
||||||
#超时时间
|
# [可选] 超时时间
|
||||||
timeout: 10000
|
timeout: 10000
|
||||||
|
# [不可用] jdbc数据库配置, 暂不支持
|
||||||
datasource:
|
datasource:
|
||||||
name: eiot
|
name: eiot
|
||||||
url: jdbc:mysql://127.0.0.1:3306/eiot?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true
|
url: jdbc:mysql://127.0.0.1:3306/eiot?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true
|
||||||
|
@ -22,36 +26,62 @@ spring:
|
||||||
password:
|
password:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driver-class-name: com.mysql.jdbc.Driver
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
|
|
||||||
|
# [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
|
||||||
server:
|
server:
|
||||||
port: 18080
|
port: 18080
|
||||||
|
|
||||||
|
# 作为28181服务器的配置
|
||||||
sip:
|
sip:
|
||||||
ip: 192.168.1.44
|
# [必须修改] 本机的IP, 必须是网卡上的IP
|
||||||
|
ip: 192.168.1.20
|
||||||
|
# [可选] 28181服务监听的端口
|
||||||
port: 5060
|
port: 5060
|
||||||
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
|
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
|
||||||
# 后两位为行业编码,定义参照附录D.3
|
# 后两位为行业编码,定义参照附录D.3
|
||||||
# 3701020049标识山东济南历下区 信息行业接入
|
# 3701020049标识山东济南历下区 信息行业接入
|
||||||
|
# [可选]
|
||||||
domain: 3402000000
|
domain: 3402000000
|
||||||
|
# [可选]
|
||||||
id: 34020000002000000001
|
id: 34020000002000000001
|
||||||
# 默认设备认证密码,后续扩展使用设备单独密码
|
# [可选] 默认设备认证密码,后续扩展使用设备单独密码
|
||||||
password: 12345678
|
password: 12345678
|
||||||
|
|
||||||
auth: #32位小写md5加密(默认密码为admin)
|
# 登陆的用户名密码
|
||||||
|
auth:
|
||||||
|
# [可选] 用户名
|
||||||
username: admin
|
username: admin
|
||||||
|
# [可选] 密码, 默认为admin
|
||||||
password: 21232f297a57a5a743894a0e4a801fc3
|
password: 21232f297a57a5a743894a0e4a801fc3
|
||||||
|
|
||||||
media: #zlm服务器的ip与http端口, 重点: 这是http端口
|
#zlm服务器配置
|
||||||
ip: 192.168.1.44
|
media:
|
||||||
wanIp:
|
# [必须修改] zlm服务器的内网IP
|
||||||
port: 80
|
ip: 127.0.0.1
|
||||||
|
# [可选] zlm服务器的公网IP, 内网部署置空即可
|
||||||
|
wanIp: 192.168.1.20
|
||||||
|
# [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip
|
||||||
|
hookIp:
|
||||||
|
# [必须修改] zlm服务器的http.port
|
||||||
|
port: 6080
|
||||||
|
# [可选] 是否自动配置ZLM, 如果希望手动配置ZLM, 可以设为false, 不建议新接触的用户修改
|
||||||
|
autoConfig: true
|
||||||
|
# [可选] zlm服务器的hook.admin_params=secret
|
||||||
secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc
|
secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc
|
||||||
|
# [可选] zlm服务器的general.streamNoneReaderDelayMS
|
||||||
streamNoneReaderDelayMS: 600000 # 无人观看多久自动关闭流
|
streamNoneReaderDelayMS: 600000 # 无人观看多久自动关闭流
|
||||||
# 关闭等待收到流编码信息后在返回,
|
# [可选] 关闭等待收到流编码信息后在返回,
|
||||||
# 设为false可以获得更好的兼容性,保证返回后流就可以播放,
|
# 设为false可以获得更好的兼容性,保证返回后流就可以播放,
|
||||||
# 设为true可以快速打开播放窗口,可以获得更好的体验
|
# 设为true可以快速打开播放窗口,可以获得更好的体验
|
||||||
closeWaitRTPInfo: true
|
closeWaitRTPInfo: false
|
||||||
rtp: # 启用udp多端口模式
|
# 启用udp多端口模式, 详细解释参考: https://github.com/xia-chu/ZLMediaKit/wiki/GB28181%E6%8E%A8%E6%B5%81 下的高阶使用
|
||||||
|
rtp:
|
||||||
|
# [可选] 是否启用udp多端口模式, 开启后会在udpPortRange范围内选择端口用于媒体流传输
|
||||||
enable: true
|
enable: true
|
||||||
|
# [可选] 在此范围内选择端口用于媒体流传输, 不只是udp, 使用TCP被动传输模式时,也是从这个范围内选择端口
|
||||||
udpPortRange: 30000,30500 # 端口范围
|
udpPortRange: 30000,30500 # 端口范围
|
||||||
|
|
||||||
|
# [可选] 日志配置, 一般不需要改
|
||||||
logging:
|
logging:
|
||||||
file:
|
file:
|
||||||
name: logs/wvp.log
|
name: logs/wvp.log
|
||||||
|
@ -62,3 +92,5 @@ logging:
|
||||||
com:
|
com:
|
||||||
genersoft:
|
genersoft:
|
||||||
iot: debug
|
iot: debug
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue