增加zlm代理的secret自动添加, 增加配置文件的默认值,缺少非关键参数不会无法启动,简化配置文件给新手带来的压力,前端使用wvp代理流。

This commit is contained in:
64850858 2021-06-04 16:31:45 +08:00
parent ceb3fe2145
commit 356afaa5ac
17 changed files with 290 additions and 129 deletions

View File

@ -3,6 +3,7 @@ package com.genersoft.iot.vmp;
import java.util.logging.LogManager; import java.util.logging.LogManager;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import springfox.documentation.oas.annotations.EnableOpenApi; import springfox.documentation.oas.annotations.EnableOpenApi;

View File

@ -31,9 +31,5 @@ public class ApplicationCheckRunner implements CommandLineRunner {
System.exit(1); System.exit(1);
} }
if (mediaConfig.getIp().equals("localhost") || (mediaConfig.getIp().equals("127.0.0.1") && mediaConfig.getWanIp() == null)) {
logger.warn("mediaIp.ip使用 {} ,将无法收到网络内其他设备的推流!!!", mediaConfig.getIp() );
}
} }
} }

View File

@ -1,7 +1,9 @@
package com.genersoft.iot.vmp.conf; package com.genersoft.iot.vmp.conf;
import io.netty.util.internal.StringUtil;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;
@Configuration("mediaConfig") @Configuration("mediaConfig")
public class MediaConfig { public class MediaConfig {
@ -9,40 +11,40 @@ public class MediaConfig {
@Value("${media.ip}") @Value("${media.ip}")
private String ip; private String ip;
@Value("${media.wanIp}") @Value("${media.hookIp:${sip.ip}}")
private String wanIp;
@Value("${media.hookIp}")
private String hookIp; private String hookIp;
@Value("${media.sdpIp:${media.ip}}")
private String sdpIp;
@Value("${media.httpPort}") @Value("${media.httpPort}")
private String httpPort; private String httpPort;
@Value("${media.httpSSlPort}") @Value("${media.httpSSlPort:}")
private String httpSSlPort; private String httpSSlPort;
@Value("${media.rtmpPort}") @Value("${media.rtmpPort:}")
private String rtmpPort; private String rtmpPort;
@Value("${media.rtmpSSlPort}") @Value("${media.rtmpSSlPort:}")
private String rtmpSSlPort; private String rtmpSSlPort;
@Value("${media.rtpProxyPort}") @Value("${media.rtpProxyPort:}")
private String rtpProxyPort; private String rtpProxyPort;
@Value("${media.rtspPort}") @Value("${media.rtspPort:}")
private String rtspPort; private String rtspPort;
@Value("${media.rtspSSLPort}") @Value("${media.rtspSSLPort:}")
private String rtspSSLPort; private String rtspSSLPort;
@Value("${media.autoConfig}") @Value("${media.autoConfig:true}")
private boolean autoConfig; private boolean autoConfig;
@Value("${media.secret}") @Value("${media.secret}")
private String secret; private String secret;
@Value("${media.streamNoneReaderDelayMS}") @Value("${media.streamNoneReaderDelayMS:18000}")
private String streamNoneReaderDelayMS; private String streamNoneReaderDelayMS;
@Value("${media.rtp.enable}") @Value("${media.rtp.enable}")
@ -62,14 +64,6 @@ public class MediaConfig {
this.ip = ip; this.ip = ip;
} }
public String getWanIp() {
return wanIp;
}
public void setWanIp(String wanIp) {
this.wanIp = wanIp;
}
public String getHookIp() { public String getHookIp() {
return hookIp; return hookIp;
} }
@ -185,4 +179,16 @@ public class MediaConfig {
public void setRecordAssistPort(int recordAssistPort) { public void setRecordAssistPort(int recordAssistPort) {
this.recordAssistPort = recordAssistPort; this.recordAssistPort = recordAssistPort;
} }
public String getSdpIp() {
if (StringUtils.isEmpty(sdpIp)) {
return ip;
}else {
return sdpIp;
}
}
public void setSdpIp(String sdpIp) {
this.sdpIp = sdpIp;
}
} }

View File

@ -2,6 +2,8 @@ package com.genersoft.iot.vmp.conf;
import org.apache.http.HttpRequest; import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.HttpClientBuilder;
import org.mitre.dsmiley.httpproxy.ProxyServlet; import org.mitre.dsmiley.httpproxy.ProxyServlet;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -12,9 +14,14 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.net.ConnectException; import java.net.ConnectException;
import java.util.Locale; import java.util.Locale;
import java.util.Map;
@Configuration @Configuration
@ -27,10 +34,10 @@ public class ProxyServletConfig {
@Bean @Bean
public ServletRegistrationBean zlmServletRegistrationBean(){ public ServletRegistrationBean zlmServletRegistrationBean(){
String ip = StringUtils.isEmpty(mediaConfig.getWanIp())? mediaConfig.getIp(): mediaConfig.getWanIp();
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new ZLMProxySerlet(),"/zlm/*"); ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new ZLMProxySerlet(),"/zlm/*");
servletRegistrationBean.setName("zlm_Proxy"); servletRegistrationBean.setName("zlm_Proxy");
servletRegistrationBean.addInitParameter("targetUri", String.format("http://%s:%s", ip, mediaConfig.getHttpPort())); servletRegistrationBean.addInitParameter("targetUri", String.format("http://%s:%s", mediaConfig.getIp(), mediaConfig.getHttpPort()));
servletRegistrationBean.addUrlMappings();
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
servletRegistrationBean.addInitParameter("log", "true"); servletRegistrationBean.addInitParameter("log", "true");
} }
@ -38,6 +45,21 @@ public class ProxyServletConfig {
} }
class ZLMProxySerlet extends ProxyServlet{ class ZLMProxySerlet extends ProxyServlet{
@Override
protected String rewriteQueryStringFromRequest(HttpServletRequest servletRequest, String queryString) {
String queryStr = super.rewriteQueryStringFromRequest(servletRequest, queryString);
if (queryStr != null) {
queryStr += "&";
}else {
queryStr = "?";
}
queryStr += "secret=" + mediaConfig.getSecret();
return queryStr;
}
@Override @Override
protected void handleRequestException(HttpRequest proxyRequest, HttpResponse proxyResonse, Exception e){ protected void handleRequestException(HttpRequest proxyRequest, HttpResponse proxyResonse, Exception e){
System.out.println(e.getMessage()); System.out.println(e.getMessage());

View File

@ -9,18 +9,32 @@ public class SipConfig {
@Value("${sip.ip}") @Value("${sip.ip}")
private String sipIp; private String sipIp;
/**
* 默认使用sip.ip
*/
@Value("${sip.monitorIp:0.0.0.0}")
private String monitorIp;
@Value("${sip.port}") @Value("${sip.port}")
private Integer sipPort; private Integer sipPort;
@Value("${sip.domain}") @Value("${sip.domain}")
private String sipDomain; private String sipDomain;
@Value("${sip.id}") @Value("${sip.id}")
private String sipId; private String sipId;
@Value("${sip.password}") @Value("${sip.password}")
private String sipPassword; private String sipPassword;
@Value("${sip.ptz.speed:50}") @Value("${sip.ptz.speed:50}")
Integer speed; Integer speed;
public String getMonitorIp() {
return monitorIp;
}
public String getSipIp() { public String getSipIp() {
return sipIp; return sipIp;
} }

View File

@ -5,19 +5,19 @@ import org.springframework.context.annotation.Configuration;
@Configuration("userSetup") @Configuration("userSetup")
public class UserSetup { public class UserSetup {
@Value("${userSettings.savePositionHistory}") @Value("${userSettings.savePositionHistory:false}")
boolean savePositionHistory; boolean savePositionHistory;
@Value("${userSettings.autoApplyPlay}") @Value("${userSettings.autoApplyPlay}")
private boolean autoApplyPlay; private boolean autoApplyPlay;
@Value("${userSettings.seniorSdp}") @Value("${userSettings.seniorSdp:false}")
private boolean seniorSdp; private boolean seniorSdp;
@Value("${userSettings.playTimeout}") @Value("${userSettings.playTimeout:18000}")
private long playTimeout; private long playTimeout;
@Value("${userSettings.waitTrack}") @Value("${userSettings.waitTrack:false}")
private boolean waitTrack; private boolean waitTrack;
@Value("${userSettings.interfaceAuthentication}") @Value("${userSettings.interfaceAuthentication}")

View File

@ -68,6 +68,12 @@ public class Device {
*/ */
private Long registerTimeMillis; private Long registerTimeMillis;
/**
* 心跳时间
*/
private Long KeepaliveTimeMillis;
/** /**
* 通道个数 * 通道个数
*/ */
@ -176,4 +182,12 @@ public class Device {
public void setRegisterTimeMillis(Long registerTimeMillis) { public void setRegisterTimeMillis(Long registerTimeMillis) {
this.registerTimeMillis = registerTimeMillis; this.registerTimeMillis = registerTimeMillis;
} }
public Long getKeepaliveTimeMillis() {
return KeepaliveTimeMillis;
}
public void setKeepaliveTimeMillis(Long keepaliveTimeMillis) {
KeepaliveTimeMillis = keepaliveTimeMillis;
}
} }

View File

@ -379,9 +379,9 @@ public class SIPCommander implements ISIPCommander {
StringBuffer content = new StringBuffer(200); StringBuffer content = new StringBuffer(200);
content.append("v=0\r\n"); content.append("v=0\r\n");
// content.append("o=" + sipConfig.getSipId() + " 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n"); // content.append("o=" + sipConfig.getSipId() + " 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n");
content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n"); content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
content.append("s=Play\r\n"); content.append("s=Play\r\n");
content.append("c=IN IP4 "+mediaInfo.getWanIp()+"\r\n"); content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
content.append("t=0 0\r\n"); content.append("t=0 0\r\n");
if (userSetup.isSeniorSdp()) { if (userSetup.isSeniorSdp()) {
@ -482,7 +482,7 @@ public class SIPCommander implements ISIPCommander {
content.append("o="+sipConfig.getSipId()+" 0 0 IN IP4 "+sipConfig.getSipIp()+"\r\n"); content.append("o="+sipConfig.getSipId()+" 0 0 IN IP4 "+sipConfig.getSipIp()+"\r\n");
content.append("s=Playback\r\n"); content.append("s=Playback\r\n");
content.append("u="+channelId+":0\r\n"); content.append("u="+channelId+":0\r\n");
content.append("c=IN IP4 "+mediaInfo.getWanIp()+"\r\n"); content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" " content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" "
+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n"); +DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n");
String mediaPort = null; String mediaPort = null;

View File

@ -198,9 +198,9 @@ public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
StringBuffer content = new StringBuffer(200); StringBuffer content = new StringBuffer(200);
content.append("v=0\r\n"); content.append("v=0\r\n");
content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n"); content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
content.append("s=Play\r\n"); content.append("s=Play\r\n");
content.append("c=IN IP4 "+mediaInfo.getWanIp()+"\r\n"); content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
content.append("t=0 0\r\n"); content.append("t=0 0\r\n");
content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n");
content.append("a=sendonly\r\n"); content.append("a=sendonly\r\n");
@ -254,9 +254,9 @@ public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
StringBuffer content = new StringBuffer(200); StringBuffer content = new StringBuffer(200);
content.append("v=0\r\n"); content.append("v=0\r\n");
content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n"); content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
content.append("s=Play\r\n"); content.append("s=Play\r\n");
content.append("c=IN IP4 "+mediaInfo.getWanIp()+"\r\n"); content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n");
content.append("t=0 0\r\n"); content.append("t=0 0\r\n");
content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n");
content.append("a=sendonly\r\n"); content.append("a=sendonly\r\n");

View File

@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.media.zlm; package com.genersoft.iot.vmp.media.zlm;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.util.StringUtils;
public class ZLMServerConfig { public class ZLMServerConfig {
@ -34,9 +35,9 @@ public class ZLMServerConfig {
@JSONField(name = "general.streamNoneReaderDelayMS") @JSONField(name = "general.streamNoneReaderDelayMS")
private String generalStreamNoneReaderDelayMS; private String generalStreamNoneReaderDelayMS;
private String localIP; private String ip;
private String wanIp; private String sdpIp;
private long updateTime; private long updateTime;
@ -281,12 +282,12 @@ public class ZLMServerConfig {
this.generalStreamNoneReaderDelayMS = generalStreamNoneReaderDelayMS; this.generalStreamNoneReaderDelayMS = generalStreamNoneReaderDelayMS;
} }
public String getLocalIP() { public String getIp() {
return localIP; return ip;
} }
public void setLocalIP(String localIP) { public void setIp(String ip) {
this.localIP = localIP; this.ip = ip;
} }
public String getHlsFileBufSize() { public String getHlsFileBufSize() {
@ -729,14 +730,6 @@ public class ZLMServerConfig {
this.shellPhell = shellPhell; this.shellPhell = shellPhell;
} }
public String getWanIp() {
return wanIp;
}
public void setWanIp(String wanIp) {
this.wanIp = wanIp;
}
public long getUpdateTime() { public long getUpdateTime() {
return updateTime; return updateTime;
} }
@ -760,4 +753,16 @@ public class ZLMServerConfig {
public void setRtmpSslPort(String rtmpSslPort) { public void setRtmpSslPort(String rtmpSslPort) {
this.rtmpSslPort = rtmpSslPort; this.rtmpSslPort = rtmpSslPort;
} }
public String getSdpIp() {
if (StringUtils.isEmpty(sdpIp)) {
return ip;
}else {
return sdpIp;
}
}
public void setSdpIp(String sdpIp) {
this.sdpIp = sdpIp;
}
} }

View File

@ -18,8 +18,8 @@ public class ZLMServerManger {
public void updateServerCatch(ZLMServerConfig zlmServerConfig) { public void updateServerCatch(ZLMServerConfig zlmServerConfig) {
zlmServerConfig.setLocalIP(mediaConfig.getIp()); zlmServerConfig.setIp(mediaConfig.getIp());
zlmServerConfig.setWanIp(StringUtils.isEmpty(mediaConfig.getWanIp())? mediaConfig.getIp(): mediaConfig.getWanIp()); zlmServerConfig.setSdpIp(mediaConfig.getSdpIp());
zlmServerConfig.setHttpPort(mediaConfig.getHttpPort()); zlmServerConfig.setHttpPort(mediaConfig.getHttpPort());
if(!StringUtils.isEmpty(mediaConfig.getHttpSSlPort())) if(!StringUtils.isEmpty(mediaConfig.getHttpSSlPort()))

View File

@ -32,17 +32,17 @@ public class MediaServiceImpl implements IMediaService {
StreamInfo streamInfoResult = new StreamInfo(); StreamInfo streamInfoResult = new StreamInfo();
streamInfoResult.setStreamId(stream); streamInfoResult.setStreamId(stream);
streamInfoResult.setApp(app); streamInfoResult.setApp(app);
streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s", mediaInfo.getWanIp(), mediaInfo.getRtmpPort(), app, stream)); streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s", mediaInfo.getIp(), mediaInfo.getRtmpPort(), app, stream));
streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s", mediaInfo.getWanIp(), mediaInfo.getRtspPort(), app, stream)); streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s", mediaInfo.getIp(), mediaInfo.getRtspPort(), app, stream));
streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.flv", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.flv", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.flv", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.flv", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setRtc(String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); streamInfoResult.setRtc(String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setTracks(tracks); streamInfoResult.setTracks(tracks);
return streamInfoResult; return streamInfoResult;
} }

View File

@ -48,7 +48,7 @@ public class RecoderProxyController {
// 后续改为根据Id获取对应的ZLM // 后续改为根据Id获取对应的ZLM
ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
String requestURI = String.format("http://%s:%s%s?%s", String requestURI = String.format("http://%s:%s%s?%s",
mediaInfo.getLocalIP(), mediaInfo.getSdpIp(),
mediaConfig.getRecordAssistPort(), mediaConfig.getRecordAssistPort(),
baseRequestURI.substring(baseRequestURI.indexOf(mediaId) + mediaId.length()), baseRequestURI.substring(baseRequestURI.indexOf(mediaId) + mediaId.length()),
URLDecoder.decode(request.getQueryString()) URLDecoder.decode(request.getQueryString())

View File

@ -0,0 +1,140 @@
# 此配置文件只是用作展示所有配置项, 不可不直接使用
spring:
# REDIS数据库配置
redis:
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1
host: 127.0.0.1
# [必须修改] 端口号
port: 6379
# [可选] 数据库 DB
database: 6
# [可选] 访问密码,若你的redis服务器没有设置密码就不需要用密码去连接
password:
# [可选] 超时时间
timeout: 10000
# [可选] jdbc数据库配置, 项目使用sqlite作为数据库一般不需要配置
datasource:
# name: wvp
# url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true
# username:
# password:
# type: com.alibaba.druid.pool.DruidDataSource
# driver-class-name: com.mysql.cj.jdbc.Driver
name: eiot
url: jdbc:sqlite::resource:wvp.sqlite
username:
password:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: org.sqlite.JDBC
max-active: 1
min-idle: 1
# [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
server:
port: 18080
# [可选] HTTPS配置 默认不开启
ssl:
# [可选] 是否开启HTTPS访问
enabled: false
# [可选] 证书文件路径放置在resource/目录下即可修改xxx为文件名
key-store: classpath:xxx.jks
# [可选] 证书密码
key-password: password
# [可选] 证书类型, 默认为jks根据实际修改
key-store-type: JKS
# 作为28181服务器的配置
sip:
# [必须修改] 本机的IP, 必须是网卡上的IP用于sip下协议栈监听ip如果监听所有设置为0.0.0.0
monitorIp: 0.0.0.0
# [必须修改] 本机的IP
ip: 192.168.0.100
# [可选] 28181服务监听的端口
port: 5060
# 根据国标6.1.2中规定domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码由省级、市级、区级、基层编号组成参照GB/T 2260-2007
# 后两位为行业编码定义参照附录D.3
# 3701020049标识山东济南历下区 信息行业接入
# [可选]
domain: 4401020049
# [可选]
id: 44010200492000000001
# [可选] 默认设备认证密码,后续扩展使用设备单独密码
password: admin123
#zlm服务器配置
media:
# [必须修改] 本机的IP, 必须是网卡上的IP用于sip下协议栈监听ip如果监听所有设置为0.0.0.0
monitorIp: 0.0.0.0
# [必须修改] zlm服务器的内网IP
ip: 192.168.0.100
# [可选] wvp在国标信令中使用的ip此ip为摄像机可以访问到的ip 置空使用 media.ip
sdpIp:
# [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip
hookIp:
# [必须修改] zlm服务器的http.port
httpPort: 80
# [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置
httpSSlPort:
# [可选] zlm服务器的rtmp.port, 置空使用zlm配置文件配置
rtmpPort:
# [可选] zlm服务器的rtmp.sslport, 置空使用zlm配置文件配置
rtmpSSlPort:
# [可选] zlm服务器的 rtp_proxy.port, 置空使用zlm配置文件配置
rtpProxyPort:
# [可选] zlm服务器的 rtsp.port, 置空使用zlm配置文件配置
rtspPort:
# [可选] zlm服务器的 rtsp.sslport, 置空使用zlm配置文件配置
rtspSSLPort:
# [可选] 是否自动配置ZLM, 如果希望手动配置ZLM, 可以设为false, 不建议新接触的用户修改
autoConfig: true
# [可选] zlm服务器的hook.admin_params=secret
secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc
# [可选] zlm服务器的general.streamNoneReaderDelayMS
streamNoneReaderDelayMS: 18000 # 无人观看多久自动关闭流, -1表示永不自动关闭,即 关闭按需拉流
# 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分 点播超时建议使用多端口测试
rtp:
# [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输
enable: true
# [可选] 在此范围内选择端口用于媒体流传输,
portRange: 30000,30500 # 端口范围
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载 0 表示不使用
recordAssistPort: 0
# [可选] 日志配置, 一般不需要改
logging:
file:
name: logs/wvp.log
max-history: 30
max-size: 10MB
total-size-cap: 300MB
level:
com:
genersoft:
iot: info
# [根据业务需求配置]
userSettings:
# [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true
autoApplyPlay: false
# [可选] 部分设备需要扩展SDP需要打开此设置
seniorSdp: false
# 保存移动位置历史轨迹true:保留历史数据false:仅保留最后的位置(默认)
savePositionHistory: false
# 点播等待超时时间,单位:毫秒
playTimeout: 3000
# 等待音视频编码信息再返回, true 可以根据编码选择合适的播放器false 可以更快点播
waitTrack: false
# 是否开启接口鉴权
interfaceAuthentication: true
# 推流直播是否录制
recordPushLive: true
# 在线文档: swagger-ui生产环境建议关闭
springfox:
documentation:
swagger-ui:
enabled: true

View File

@ -13,12 +13,6 @@ spring:
timeout: 10000 timeout: 10000
# [可选] jdbc数据库配置, 项目使用sqlite作为数据库一般不需要配置 # [可选] jdbc数据库配置, 项目使用sqlite作为数据库一般不需要配置
datasource: datasource:
# name: wvp
# url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true
# username:
# password:
# type: com.alibaba.druid.pool.DruidDataSource
# driver-class-name: com.mysql.cj.jdbc.Driver
name: eiot name: eiot
url: jdbc:sqlite::resource:wvp.sqlite url: jdbc:sqlite::resource:wvp.sqlite
username: username:
@ -31,20 +25,10 @@ spring:
# [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 # [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
server: server:
port: 18080 port: 18080
# [可选] HTTPS配置 默认不开启
ssl:
# [可选] 是否开启HTTPS访问
enabled: false
# [可选] 证书文件路径放置在resource/目录下即可修改xxx为文件名
key-store: classpath:xxx.jks
# [可选] 证书密码
key-password: password
# [可选] 证书类型, 默认为jks根据实际修改
key-store-type: JKS
# 作为28181服务器的配置 # 作为28181服务器的配置
sip: sip:
# [必须修改] 本机的IP, 必须是网卡上的IP # [必须修改] 本机的IP
ip: 192.168.0.100 ip: 192.168.0.100
# [可选] 28181服务监听的端口 # [可选] 28181服务监听的端口
port: 5060 port: 5060
@ -62,30 +46,10 @@ sip:
media: media:
# [必须修改] zlm服务器的内网IP # [必须修改] zlm服务器的内网IP
ip: 192.168.0.100 ip: 192.168.0.100
# [可选] zlm服务器的公网IP, 内网部署置空即可
wanIp:
# [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip
hookIp:
# [必须修改] zlm服务器的http.port # [必须修改] zlm服务器的http.port
httpPort: 80 httpPort: 80
# [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置
httpSSlPort:
# [可选] zlm服务器的rtmp.port, 置空使用zlm配置文件配置
rtmpPort:
# [可选] zlm服务器的rtmp.sslport, 置空使用zlm配置文件配置
rtmpSSlPort:
# [可选] zlm服务器的 rtp_proxy.port, 置空使用zlm配置文件配置
rtpProxyPort:
# [可选] zlm服务器的 rtsp.port, 置空使用zlm配置文件配置
rtspPort:
# [可选] zlm服务器的 rtsp.sslport, 置空使用zlm配置文件配置
rtspSSLPort:
# [可选] 是否自动配置ZLM, 如果希望手动配置ZLM, 可以设为false, 不建议新接触的用户修改
autoConfig: true
# [可选] zlm服务器的hook.admin_params=secret # [可选] zlm服务器的hook.admin_params=secret
secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc
# [可选] zlm服务器的general.streamNoneReaderDelayMS
streamNoneReaderDelayMS: 18000 # 无人观看多久自动关闭流, -1表示永不自动关闭,即 关闭按需拉流
# 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分 点播超时建议使用多端口测试 # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分 点播超时建议使用多端口测试
rtp: rtp:
# [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输
@ -95,6 +59,21 @@ media:
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载 0 表示不使用 # 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载 0 表示不使用
recordAssistPort: 0 recordAssistPort: 0
# [根据业务需求配置]
userSettings:
# [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true
autoApplyPlay: false
# 是否开启接口鉴权
interfaceAuthentication: true
# 推流直播是否录制
recordPushLive: true
# 在线文档: swagger-ui生产环境建议关闭
springfox:
documentation:
swagger-ui:
enabled: true
# [可选] 日志配置, 一般不需要改 # [可选] 日志配置, 一般不需要改
logging: logging:
file: file:
@ -105,26 +84,4 @@ logging:
level: level:
com: com:
genersoft: genersoft:
iot: info iot: info
# [根据业务需求配置]
userSettings:
# [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true
autoApplyPlay: false
# [可选] 部分设备需要扩展SDP需要打开此设置
seniorSdp: false
# 保存移动位置历史轨迹true:保留历史数据false:仅保留最后的位置(默认)
savePositionHistory: false
# 点播等待超时时间,单位:毫秒
playTimeout: 3000
# 等待音视频编码信息再返回, true 可以根据编码选择合适的播放器false 可以更快点播
waitTrack: false
# 是否开启接口鉴权
interfaceAuthentication: true
# 推流直播是否录制
recordPushLive: true
# 在线文档: swagger-ui生产环境建议关闭
springfox:
documentation:
swagger-ui:
enabled: true

View File

@ -270,11 +270,18 @@ export default {
this.hasaudio = hasAudio; this.hasaudio = hasAudio;
this.isLoging = false; this.isLoging = false;
// this.videoUrl = streamInfo.rtc; // this.videoUrl = streamInfo.rtc;
this.videoUrl = streamInfo.ws_flv; this.videoUrl = this.getUrlByStreamInfo(streamInfo);
this.streamId = streamInfo.streamId; this.streamId = streamInfo.streamId;
this.app = streamInfo.app; this.app = streamInfo.app;
this.playFromStreamInfo(false, streamInfo) this.playFromStreamInfo(false, streamInfo)
}, },
getUrlByStreamInfo(streamInfo){
let baseZlmApi = process.env.NODE_ENV === 'development'?`${location.host}/debug/zlm`:`${location.host}/zlm`
console.log(12121212)
console.log(baseZlmApi)
// return `${baseZlmApi}/${streamInfo.app}/${streamInfo.streamId}.flv`;
return `http://${baseZlmApi}/${streamInfo.app}/${streamInfo.streamId}.flv`;
},
coverPlay: function () { coverPlay: function () {
var that = this; var that = this;
this.coverPlaying = true; this.coverPlaying = true;
@ -335,7 +342,7 @@ export default {
playFromStreamInfo: function (realHasAudio, streamInfo) { playFromStreamInfo: function (realHasAudio, streamInfo) {
this.showVideoDialog = true; this.showVideoDialog = true;
this.hasaudio = realHasAudio && this.hasaudio; this.hasaudio = realHasAudio && this.hasaudio;
this.$refs.videoPlayer.play(streamInfo.ws_flv) this.$refs.videoPlayer.play(this.getUrlByStreamInfo(streamInfo))
}, },
close: function () { close: function () {
console.log('关闭视频'); console.log('关闭视频');
@ -418,7 +425,7 @@ export default {
}).then(function (res) { }).then(function (res) {
var streamInfo = res.data; var streamInfo = res.data;
that.streamId = streamInfo.streamId; that.streamId = streamInfo.streamId;
that.videoUrl = streamInfo.ws_flv; that.videoUrl = this.getUrlByStreamInfo(streamInfo);
that.recordPlay = true; that.recordPlay = true;
}); });
} }

View File

@ -55,7 +55,6 @@ axios.interceptors.response.use(function (response) {
Vue.prototype.$cookies.config(60*30); Vue.prototype.$cookies.config(60*30);
new Vue({ new Vue({
router: router, router: router,
render: h => h(App), render: h => h(App),