Commit 1b677c6dc79b8e3b650acd94da7fc770c3d2718d
1 parent
8aaac8c4
增加zlm代理的secret自动添加, 增加配置文件的默认值,缺少非关键参数不会无法启动,简化配置文件给新手带来的压力,前端使用wvp代理流。
Showing
17 changed files
with
287 additions
and
126 deletions
src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java
| @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp; | @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp; | ||
| 3 | import java.util.logging.LogManager; | 3 | import java.util.logging.LogManager; |
| 4 | 4 | ||
| 5 | import org.springframework.boot.SpringApplication; | 5 | import org.springframework.boot.SpringApplication; |
| 6 | +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
| 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 7 | import org.springframework.context.ConfigurableApplicationContext; | 8 | import org.springframework.context.ConfigurableApplicationContext; |
| 8 | import springfox.documentation.oas.annotations.EnableOpenApi; | 9 | import springfox.documentation.oas.annotations.EnableOpenApi; |
src/main/java/com/genersoft/iot/vmp/conf/ApplicationCheckRunner.java
| @@ -31,9 +31,5 @@ public class ApplicationCheckRunner implements CommandLineRunner { | @@ -31,9 +31,5 @@ public class ApplicationCheckRunner implements CommandLineRunner { | ||
| 31 | System.exit(1); | 31 | System.exit(1); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | - if (mediaConfig.getIp().equals("localhost") || (mediaConfig.getIp().equals("127.0.0.1") && mediaConfig.getWanIp() == null)) { | ||
| 35 | - logger.warn("mediaIp.ip使用 {} ,将无法收到网络内其他设备的推流!!!", mediaConfig.getIp() ); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | } | 34 | } |
| 39 | } | 35 | } |
src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java
| 1 | package com.genersoft.iot.vmp.conf; | 1 | package com.genersoft.iot.vmp.conf; |
| 2 | 2 | ||
| 3 | +import io.netty.util.internal.StringUtil; | ||
| 3 | import org.springframework.beans.factory.annotation.Value; | 4 | import org.springframework.beans.factory.annotation.Value; |
| 4 | import org.springframework.context.annotation.Configuration; | 5 | import org.springframework.context.annotation.Configuration; |
| 6 | +import org.springframework.util.StringUtils; | ||
| 5 | 7 | ||
| 6 | @Configuration("mediaConfig") | 8 | @Configuration("mediaConfig") |
| 7 | public class MediaConfig { | 9 | public class MediaConfig { |
| @@ -9,40 +11,40 @@ public class MediaConfig { | @@ -9,40 +11,40 @@ public class MediaConfig { | ||
| 9 | @Value("${media.ip}") | 11 | @Value("${media.ip}") |
| 10 | private String ip; | 12 | private String ip; |
| 11 | 13 | ||
| 12 | - @Value("${media.wanIp}") | ||
| 13 | - private String wanIp; | ||
| 14 | - | ||
| 15 | - @Value("${media.hookIp}") | 14 | + @Value("${media.hookIp:${sip.ip}}") |
| 16 | private String hookIp; | 15 | private String hookIp; |
| 17 | 16 | ||
| 17 | + @Value("${media.sdpIp:${media.ip}}") | ||
| 18 | + private String sdpIp; | ||
| 19 | + | ||
| 18 | @Value("${media.httpPort}") | 20 | @Value("${media.httpPort}") |
| 19 | private String httpPort; | 21 | private String httpPort; |
| 20 | 22 | ||
| 21 | - @Value("${media.httpSSlPort}") | 23 | + @Value("${media.httpSSlPort:}") |
| 22 | private String httpSSlPort; | 24 | private String httpSSlPort; |
| 23 | 25 | ||
| 24 | - @Value("${media.rtmpPort}") | 26 | + @Value("${media.rtmpPort:}") |
| 25 | private String rtmpPort; | 27 | private String rtmpPort; |
| 26 | 28 | ||
| 27 | - @Value("${media.rtmpSSlPort}") | 29 | + @Value("${media.rtmpSSlPort:}") |
| 28 | private String rtmpSSlPort; | 30 | private String rtmpSSlPort; |
| 29 | 31 | ||
| 30 | - @Value("${media.rtpProxyPort}") | 32 | + @Value("${media.rtpProxyPort:}") |
| 31 | private String rtpProxyPort; | 33 | private String rtpProxyPort; |
| 32 | 34 | ||
| 33 | - @Value("${media.rtspPort}") | 35 | + @Value("${media.rtspPort:}") |
| 34 | private String rtspPort; | 36 | private String rtspPort; |
| 35 | 37 | ||
| 36 | - @Value("${media.rtspSSLPort}") | 38 | + @Value("${media.rtspSSLPort:}") |
| 37 | private String rtspSSLPort; | 39 | private String rtspSSLPort; |
| 38 | 40 | ||
| 39 | - @Value("${media.autoConfig}") | 41 | + @Value("${media.autoConfig:true}") |
| 40 | private boolean autoConfig; | 42 | private boolean autoConfig; |
| 41 | 43 | ||
| 42 | @Value("${media.secret}") | 44 | @Value("${media.secret}") |
| 43 | private String secret; | 45 | private String secret; |
| 44 | 46 | ||
| 45 | - @Value("${media.streamNoneReaderDelayMS}") | 47 | + @Value("${media.streamNoneReaderDelayMS:18000}") |
| 46 | private String streamNoneReaderDelayMS; | 48 | private String streamNoneReaderDelayMS; |
| 47 | 49 | ||
| 48 | @Value("${media.rtp.enable}") | 50 | @Value("${media.rtp.enable}") |
| @@ -62,14 +64,6 @@ public class MediaConfig { | @@ -62,14 +64,6 @@ public class MediaConfig { | ||
| 62 | this.ip = ip; | 64 | this.ip = ip; |
| 63 | } | 65 | } |
| 64 | 66 | ||
| 65 | - public String getWanIp() { | ||
| 66 | - return wanIp; | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - public void setWanIp(String wanIp) { | ||
| 70 | - this.wanIp = wanIp; | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | public String getHookIp() { | 67 | public String getHookIp() { |
| 74 | return hookIp; | 68 | return hookIp; |
| 75 | } | 69 | } |
| @@ -185,4 +179,16 @@ public class MediaConfig { | @@ -185,4 +179,16 @@ public class MediaConfig { | ||
| 185 | public void setRecordAssistPort(int recordAssistPort) { | 179 | public void setRecordAssistPort(int recordAssistPort) { |
| 186 | this.recordAssistPort = recordAssistPort; | 180 | this.recordAssistPort = recordAssistPort; |
| 187 | } | 181 | } |
| 182 | + | ||
| 183 | + public String getSdpIp() { | ||
| 184 | + if (StringUtils.isEmpty(sdpIp)) { | ||
| 185 | + return ip; | ||
| 186 | + }else { | ||
| 187 | + return sdpIp; | ||
| 188 | + } | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + public void setSdpIp(String sdpIp) { | ||
| 192 | + this.sdpIp = sdpIp; | ||
| 193 | + } | ||
| 188 | } | 194 | } |
src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java
| @@ -2,6 +2,8 @@ package com.genersoft.iot.vmp.conf; | @@ -2,6 +2,8 @@ package com.genersoft.iot.vmp.conf; | ||
| 2 | 2 | ||
| 3 | import org.apache.http.HttpRequest; | 3 | import org.apache.http.HttpRequest; |
| 4 | import org.apache.http.HttpResponse; | 4 | import org.apache.http.HttpResponse; |
| 5 | +import org.apache.http.client.config.RequestConfig; | ||
| 6 | +import org.apache.http.impl.client.HttpClientBuilder; | ||
| 5 | import org.mitre.dsmiley.httpproxy.ProxyServlet; | 7 | import org.mitre.dsmiley.httpproxy.ProxyServlet; |
| 6 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
| 7 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
| @@ -12,9 +14,14 @@ import org.springframework.context.annotation.Configuration; | @@ -12,9 +14,14 @@ import org.springframework.context.annotation.Configuration; | ||
| 12 | import org.springframework.util.StringUtils; | 14 | import org.springframework.util.StringUtils; |
| 13 | 15 | ||
| 14 | import javax.servlet.ServletException; | 16 | import javax.servlet.ServletException; |
| 17 | +import javax.servlet.ServletRequest; | ||
| 18 | +import javax.servlet.ServletResponse; | ||
| 19 | +import javax.servlet.http.HttpServletRequest; | ||
| 20 | +import javax.servlet.http.HttpServletResponse; | ||
| 15 | import java.io.IOException; | 21 | import java.io.IOException; |
| 16 | import java.net.ConnectException; | 22 | import java.net.ConnectException; |
| 17 | import java.util.Locale; | 23 | import java.util.Locale; |
| 24 | +import java.util.Map; | ||
| 18 | 25 | ||
| 19 | 26 | ||
| 20 | @Configuration | 27 | @Configuration |
| @@ -27,10 +34,10 @@ public class ProxyServletConfig { | @@ -27,10 +34,10 @@ public class ProxyServletConfig { | ||
| 27 | 34 | ||
| 28 | @Bean | 35 | @Bean |
| 29 | public ServletRegistrationBean zlmServletRegistrationBean(){ | 36 | public ServletRegistrationBean zlmServletRegistrationBean(){ |
| 30 | - String ip = StringUtils.isEmpty(mediaConfig.getWanIp())? mediaConfig.getIp(): mediaConfig.getWanIp(); | ||
| 31 | ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new ZLMProxySerlet(),"/zlm/*"); | 37 | ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new ZLMProxySerlet(),"/zlm/*"); |
| 32 | servletRegistrationBean.setName("zlm_Proxy"); | 38 | servletRegistrationBean.setName("zlm_Proxy"); |
| 33 | - servletRegistrationBean.addInitParameter("targetUri", String.format("http://%s:%s", ip, mediaConfig.getHttpPort())); | 39 | + servletRegistrationBean.addInitParameter("targetUri", String.format("http://%s:%s", mediaConfig.getIp(), mediaConfig.getHttpPort())); |
| 40 | + servletRegistrationBean.addUrlMappings(); | ||
| 34 | if (logger.isDebugEnabled()) { | 41 | if (logger.isDebugEnabled()) { |
| 35 | servletRegistrationBean.addInitParameter("log", "true"); | 42 | servletRegistrationBean.addInitParameter("log", "true"); |
| 36 | } | 43 | } |
| @@ -38,6 +45,21 @@ public class ProxyServletConfig { | @@ -38,6 +45,21 @@ public class ProxyServletConfig { | ||
| 38 | } | 45 | } |
| 39 | 46 | ||
| 40 | class ZLMProxySerlet extends ProxyServlet{ | 47 | class ZLMProxySerlet extends ProxyServlet{ |
| 48 | + | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + @Override | ||
| 52 | + protected String rewriteQueryStringFromRequest(HttpServletRequest servletRequest, String queryString) { | ||
| 53 | + String queryStr = super.rewriteQueryStringFromRequest(servletRequest, queryString); | ||
| 54 | + if (queryStr != null) { | ||
| 55 | + queryStr += "&"; | ||
| 56 | + }else { | ||
| 57 | + queryStr = "?"; | ||
| 58 | + } | ||
| 59 | + queryStr += "secret=" + mediaConfig.getSecret(); | ||
| 60 | + return queryStr; | ||
| 61 | + } | ||
| 62 | + | ||
| 41 | @Override | 63 | @Override |
| 42 | protected void handleRequestException(HttpRequest proxyRequest, HttpResponse proxyResonse, Exception e){ | 64 | protected void handleRequestException(HttpRequest proxyRequest, HttpResponse proxyResonse, Exception e){ |
| 43 | System.out.println(e.getMessage()); | 65 | System.out.println(e.getMessage()); |
src/main/java/com/genersoft/iot/vmp/conf/SipConfig.java
| @@ -9,18 +9,32 @@ public class SipConfig { | @@ -9,18 +9,32 @@ public class SipConfig { | ||
| 9 | 9 | ||
| 10 | @Value("${sip.ip}") | 10 | @Value("${sip.ip}") |
| 11 | private String sipIp; | 11 | private String sipIp; |
| 12 | + | ||
| 13 | + /** | ||
| 14 | + * 默认使用sip.ip | ||
| 15 | + */ | ||
| 16 | + @Value("${sip.monitorIp:0.0.0.0}") | ||
| 17 | + private String monitorIp; | ||
| 18 | + | ||
| 12 | @Value("${sip.port}") | 19 | @Value("${sip.port}") |
| 13 | private Integer sipPort; | 20 | private Integer sipPort; |
| 21 | + | ||
| 14 | @Value("${sip.domain}") | 22 | @Value("${sip.domain}") |
| 15 | private String sipDomain; | 23 | private String sipDomain; |
| 24 | + | ||
| 16 | @Value("${sip.id}") | 25 | @Value("${sip.id}") |
| 17 | private String sipId; | 26 | private String sipId; |
| 27 | + | ||
| 18 | @Value("${sip.password}") | 28 | @Value("${sip.password}") |
| 19 | private String sipPassword; | 29 | private String sipPassword; |
| 20 | 30 | ||
| 21 | @Value("${sip.ptz.speed:50}") | 31 | @Value("${sip.ptz.speed:50}") |
| 22 | Integer speed; | 32 | Integer speed; |
| 23 | 33 | ||
| 34 | + public String getMonitorIp() { | ||
| 35 | + return monitorIp; | ||
| 36 | + } | ||
| 37 | + | ||
| 24 | public String getSipIp() { | 38 | public String getSipIp() { |
| 25 | return sipIp; | 39 | return sipIp; |
| 26 | } | 40 | } |
src/main/java/com/genersoft/iot/vmp/conf/UserSetup.java
| @@ -5,19 +5,19 @@ import org.springframework.context.annotation.Configuration; | @@ -5,19 +5,19 @@ import org.springframework.context.annotation.Configuration; | ||
| 5 | 5 | ||
| 6 | @Configuration("userSetup") | 6 | @Configuration("userSetup") |
| 7 | public class UserSetup { | 7 | public class UserSetup { |
| 8 | - @Value("${userSettings.savePositionHistory}") | 8 | + @Value("${userSettings.savePositionHistory:false}") |
| 9 | boolean savePositionHistory; | 9 | boolean savePositionHistory; |
| 10 | 10 | ||
| 11 | @Value("${userSettings.autoApplyPlay}") | 11 | @Value("${userSettings.autoApplyPlay}") |
| 12 | private boolean autoApplyPlay; | 12 | private boolean autoApplyPlay; |
| 13 | 13 | ||
| 14 | - @Value("${userSettings.seniorSdp}") | 14 | + @Value("${userSettings.seniorSdp:false}") |
| 15 | private boolean seniorSdp; | 15 | private boolean seniorSdp; |
| 16 | 16 | ||
| 17 | - @Value("${userSettings.playTimeout}") | 17 | + @Value("${userSettings.playTimeout:18000}") |
| 18 | private long playTimeout; | 18 | private long playTimeout; |
| 19 | 19 | ||
| 20 | - @Value("${userSettings.waitTrack}") | 20 | + @Value("${userSettings.waitTrack:false}") |
| 21 | private boolean waitTrack; | 21 | private boolean waitTrack; |
| 22 | 22 | ||
| 23 | @Value("${userSettings.interfaceAuthentication}") | 23 | @Value("${userSettings.interfaceAuthentication}") |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
| @@ -68,6 +68,12 @@ public class Device { | @@ -68,6 +68,12 @@ public class Device { | ||
| 68 | */ | 68 | */ |
| 69 | private Long registerTimeMillis; | 69 | private Long registerTimeMillis; |
| 70 | 70 | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 心跳时间 | ||
| 74 | + */ | ||
| 75 | + private Long KeepaliveTimeMillis; | ||
| 76 | + | ||
| 71 | /** | 77 | /** |
| 72 | * 通道个数 | 78 | * 通道个数 |
| 73 | */ | 79 | */ |
| @@ -176,4 +182,12 @@ public class Device { | @@ -176,4 +182,12 @@ public class Device { | ||
| 176 | public void setRegisterTimeMillis(Long registerTimeMillis) { | 182 | public void setRegisterTimeMillis(Long registerTimeMillis) { |
| 177 | this.registerTimeMillis = registerTimeMillis; | 183 | this.registerTimeMillis = registerTimeMillis; |
| 178 | } | 184 | } |
| 185 | + | ||
| 186 | + public Long getKeepaliveTimeMillis() { | ||
| 187 | + return KeepaliveTimeMillis; | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + public void setKeepaliveTimeMillis(Long keepaliveTimeMillis) { | ||
| 191 | + KeepaliveTimeMillis = keepaliveTimeMillis; | ||
| 192 | + } | ||
| 179 | } | 193 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -379,9 +379,9 @@ public class SIPCommander implements ISIPCommander { | @@ -379,9 +379,9 @@ public class SIPCommander implements ISIPCommander { | ||
| 379 | StringBuffer content = new StringBuffer(200); | 379 | StringBuffer content = new StringBuffer(200); |
| 380 | content.append("v=0\r\n"); | 380 | content.append("v=0\r\n"); |
| 381 | // content.append("o=" + sipConfig.getSipId() + " 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n"); | 381 | // content.append("o=" + sipConfig.getSipId() + " 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n"); |
| 382 | - content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n"); | 382 | + content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getSdpIp()+"\r\n"); |
| 383 | content.append("s=Play\r\n"); | 383 | content.append("s=Play\r\n"); |
| 384 | - content.append("c=IN IP4 "+mediaInfo.getWanIp()+"\r\n"); | 384 | + content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n"); |
| 385 | content.append("t=0 0\r\n"); | 385 | content.append("t=0 0\r\n"); |
| 386 | 386 | ||
| 387 | if (userSetup.isSeniorSdp()) { | 387 | if (userSetup.isSeniorSdp()) { |
| @@ -482,7 +482,7 @@ public class SIPCommander implements ISIPCommander { | @@ -482,7 +482,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 482 | content.append("o="+sipConfig.getSipId()+" 0 0 IN IP4 "+sipConfig.getSipIp()+"\r\n"); | 482 | content.append("o="+sipConfig.getSipId()+" 0 0 IN IP4 "+sipConfig.getSipIp()+"\r\n"); |
| 483 | content.append("s=Playback\r\n"); | 483 | content.append("s=Playback\r\n"); |
| 484 | content.append("u="+channelId+":0\r\n"); | 484 | content.append("u="+channelId+":0\r\n"); |
| 485 | - content.append("c=IN IP4 "+mediaInfo.getWanIp()+"\r\n"); | 485 | + content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n"); |
| 486 | content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" " | 486 | content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" " |
| 487 | +DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n"); | 487 | +DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n"); |
| 488 | String mediaPort = null; | 488 | String mediaPort = null; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
| @@ -198,9 +198,9 @@ public class InviteRequestProcessor extends SIPRequestAbstractProcessor { | @@ -198,9 +198,9 @@ public class InviteRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 198 | ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); | 198 | ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); |
| 199 | StringBuffer content = new StringBuffer(200); | 199 | StringBuffer content = new StringBuffer(200); |
| 200 | content.append("v=0\r\n"); | 200 | content.append("v=0\r\n"); |
| 201 | - content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n"); | 201 | + content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getSdpIp()+"\r\n"); |
| 202 | content.append("s=Play\r\n"); | 202 | content.append("s=Play\r\n"); |
| 203 | - content.append("c=IN IP4 "+mediaInfo.getWanIp()+"\r\n"); | 203 | + content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n"); |
| 204 | content.append("t=0 0\r\n"); | 204 | content.append("t=0 0\r\n"); |
| 205 | content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); | 205 | content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); |
| 206 | content.append("a=sendonly\r\n"); | 206 | content.append("a=sendonly\r\n"); |
| @@ -254,9 +254,9 @@ public class InviteRequestProcessor extends SIPRequestAbstractProcessor { | @@ -254,9 +254,9 @@ public class InviteRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 254 | ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); | 254 | ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); |
| 255 | StringBuffer content = new StringBuffer(200); | 255 | StringBuffer content = new StringBuffer(200); |
| 256 | content.append("v=0\r\n"); | 256 | content.append("v=0\r\n"); |
| 257 | - content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getWanIp()+"\r\n"); | 257 | + content.append("o="+"00000"+" 0 0 IN IP4 "+mediaInfo.getSdpIp()+"\r\n"); |
| 258 | content.append("s=Play\r\n"); | 258 | content.append("s=Play\r\n"); |
| 259 | - content.append("c=IN IP4 "+mediaInfo.getWanIp()+"\r\n"); | 259 | + content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n"); |
| 260 | content.append("t=0 0\r\n"); | 260 | content.append("t=0 0\r\n"); |
| 261 | content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); | 261 | content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); |
| 262 | content.append("a=sendonly\r\n"); | 262 | content.append("a=sendonly\r\n"); |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java
| 1 | package com.genersoft.iot.vmp.media.zlm; | 1 | package com.genersoft.iot.vmp.media.zlm; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.annotation.JSONField; | 3 | import com.alibaba.fastjson.annotation.JSONField; |
| 4 | +import org.springframework.util.StringUtils; | ||
| 4 | 5 | ||
| 5 | public class ZLMServerConfig { | 6 | public class ZLMServerConfig { |
| 6 | 7 | ||
| @@ -34,9 +35,9 @@ public class ZLMServerConfig { | @@ -34,9 +35,9 @@ public class ZLMServerConfig { | ||
| 34 | @JSONField(name = "general.streamNoneReaderDelayMS") | 35 | @JSONField(name = "general.streamNoneReaderDelayMS") |
| 35 | private String generalStreamNoneReaderDelayMS; | 36 | private String generalStreamNoneReaderDelayMS; |
| 36 | 37 | ||
| 37 | - private String localIP; | 38 | + private String ip; |
| 38 | 39 | ||
| 39 | - private String wanIp; | 40 | + private String sdpIp; |
| 40 | 41 | ||
| 41 | private long updateTime; | 42 | private long updateTime; |
| 42 | 43 | ||
| @@ -281,12 +282,12 @@ public class ZLMServerConfig { | @@ -281,12 +282,12 @@ public class ZLMServerConfig { | ||
| 281 | this.generalStreamNoneReaderDelayMS = generalStreamNoneReaderDelayMS; | 282 | this.generalStreamNoneReaderDelayMS = generalStreamNoneReaderDelayMS; |
| 282 | } | 283 | } |
| 283 | 284 | ||
| 284 | - public String getLocalIP() { | ||
| 285 | - return localIP; | 285 | + public String getIp() { |
| 286 | + return ip; | ||
| 286 | } | 287 | } |
| 287 | 288 | ||
| 288 | - public void setLocalIP(String localIP) { | ||
| 289 | - this.localIP = localIP; | 289 | + public void setIp(String ip) { |
| 290 | + this.ip = ip; | ||
| 290 | } | 291 | } |
| 291 | 292 | ||
| 292 | public String getHlsFileBufSize() { | 293 | public String getHlsFileBufSize() { |
| @@ -729,14 +730,6 @@ public class ZLMServerConfig { | @@ -729,14 +730,6 @@ public class ZLMServerConfig { | ||
| 729 | this.shellPhell = shellPhell; | 730 | this.shellPhell = shellPhell; |
| 730 | } | 731 | } |
| 731 | 732 | ||
| 732 | - public String getWanIp() { | ||
| 733 | - return wanIp; | ||
| 734 | - } | ||
| 735 | - | ||
| 736 | - public void setWanIp(String wanIp) { | ||
| 737 | - this.wanIp = wanIp; | ||
| 738 | - } | ||
| 739 | - | ||
| 740 | public long getUpdateTime() { | 733 | public long getUpdateTime() { |
| 741 | return updateTime; | 734 | return updateTime; |
| 742 | } | 735 | } |
| @@ -760,4 +753,16 @@ public class ZLMServerConfig { | @@ -760,4 +753,16 @@ public class ZLMServerConfig { | ||
| 760 | public void setRtmpSslPort(String rtmpSslPort) { | 753 | public void setRtmpSslPort(String rtmpSslPort) { |
| 761 | this.rtmpSslPort = rtmpSslPort; | 754 | this.rtmpSslPort = rtmpSslPort; |
| 762 | } | 755 | } |
| 756 | + | ||
| 757 | + public String getSdpIp() { | ||
| 758 | + if (StringUtils.isEmpty(sdpIp)) { | ||
| 759 | + return ip; | ||
| 760 | + }else { | ||
| 761 | + return sdpIp; | ||
| 762 | + } | ||
| 763 | + } | ||
| 764 | + | ||
| 765 | + public void setSdpIp(String sdpIp) { | ||
| 766 | + this.sdpIp = sdpIp; | ||
| 767 | + } | ||
| 763 | } | 768 | } |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerManger.java
| @@ -18,8 +18,8 @@ public class ZLMServerManger { | @@ -18,8 +18,8 @@ public class ZLMServerManger { | ||
| 18 | 18 | ||
| 19 | public void updateServerCatch(ZLMServerConfig zlmServerConfig) { | 19 | public void updateServerCatch(ZLMServerConfig zlmServerConfig) { |
| 20 | 20 | ||
| 21 | - zlmServerConfig.setLocalIP(mediaConfig.getIp()); | ||
| 22 | - zlmServerConfig.setWanIp(StringUtils.isEmpty(mediaConfig.getWanIp())? mediaConfig.getIp(): mediaConfig.getWanIp()); | 21 | + zlmServerConfig.setIp(mediaConfig.getIp()); |
| 22 | + zlmServerConfig.setSdpIp(mediaConfig.getSdpIp()); | ||
| 23 | zlmServerConfig.setHttpPort(mediaConfig.getHttpPort()); | 23 | zlmServerConfig.setHttpPort(mediaConfig.getHttpPort()); |
| 24 | 24 | ||
| 25 | if(!StringUtils.isEmpty(mediaConfig.getHttpSSlPort())) | 25 | if(!StringUtils.isEmpty(mediaConfig.getHttpSSlPort())) |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
| @@ -32,17 +32,17 @@ public class MediaServiceImpl implements IMediaService { | @@ -32,17 +32,17 @@ public class MediaServiceImpl implements IMediaService { | ||
| 32 | StreamInfo streamInfoResult = new StreamInfo(); | 32 | StreamInfo streamInfoResult = new StreamInfo(); |
| 33 | streamInfoResult.setStreamId(stream); | 33 | streamInfoResult.setStreamId(stream); |
| 34 | streamInfoResult.setApp(app); | 34 | streamInfoResult.setApp(app); |
| 35 | - streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s", mediaInfo.getWanIp(), mediaInfo.getRtmpPort(), app, stream)); | ||
| 36 | - streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s", mediaInfo.getWanIp(), mediaInfo.getRtspPort(), app, stream)); | ||
| 37 | - streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.flv", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 38 | - streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.flv", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 39 | - streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 40 | - streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 41 | - streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 42 | - streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 43 | - streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 44 | - streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 45 | - streamInfoResult.setRtc(String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream)); | 35 | + streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s", mediaInfo.getIp(), mediaInfo.getRtmpPort(), app, stream)); |
| 36 | + streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s", mediaInfo.getIp(), mediaInfo.getRtspPort(), app, stream)); | ||
| 37 | + streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.flv", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 38 | + streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.flv", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 39 | + streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 40 | + streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 41 | + streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 42 | + streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 43 | + streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 44 | + streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 45 | + streamInfoResult.setRtc(String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play", mediaInfo.getIp(), mediaInfo.getHttpPort(), app, stream)); | ||
| 46 | streamInfoResult.setTracks(tracks); | 46 | streamInfoResult.setTracks(tracks); |
| 47 | return streamInfoResult; | 47 | return streamInfoResult; |
| 48 | } | 48 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/record/RecoderProxyController.java
| @@ -48,7 +48,7 @@ public class RecoderProxyController { | @@ -48,7 +48,7 @@ public class RecoderProxyController { | ||
| 48 | // 后续改为根据Id获取对应的ZLM | 48 | // 后续改为根据Id获取对应的ZLM |
| 49 | ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); | 49 | ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); |
| 50 | String requestURI = String.format("http://%s:%s%s?%s", | 50 | String requestURI = String.format("http://%s:%s%s?%s", |
| 51 | - mediaInfo.getLocalIP(), | 51 | + mediaInfo.getSdpIp(), |
| 52 | mediaConfig.getRecordAssistPort(), | 52 | mediaConfig.getRecordAssistPort(), |
| 53 | baseRequestURI.substring(baseRequestURI.indexOf(mediaId) + mediaId.length()), | 53 | baseRequestURI.substring(baseRequestURI.indexOf(mediaId) + mediaId.length()), |
| 54 | URLDecoder.decode(request.getQueryString()) | 54 | URLDecoder.decode(request.getQueryString()) |
src/main/resources/all-application.yml
0 → 100644
| 1 | + | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +# 此配置文件只是用作展示所有配置项, 不可不直接使用 | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +spring: | ||
| 8 | + # REDIS数据库配置 | ||
| 9 | + redis: | ||
| 10 | + # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 | ||
| 11 | + host: 127.0.0.1 | ||
| 12 | + # [必须修改] 端口号 | ||
| 13 | + port: 6379 | ||
| 14 | + # [可选] 数据库 DB | ||
| 15 | + database: 6 | ||
| 16 | + # [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 | ||
| 17 | + password: | ||
| 18 | + # [可选] 超时时间 | ||
| 19 | + timeout: 10000 | ||
| 20 | + # [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置 | ||
| 21 | + datasource: | ||
| 22 | + # name: wvp | ||
| 23 | + # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true | ||
| 24 | + # username: | ||
| 25 | + # password: | ||
| 26 | + # type: com.alibaba.druid.pool.DruidDataSource | ||
| 27 | + # driver-class-name: com.mysql.cj.jdbc.Driver | ||
| 28 | + name: eiot | ||
| 29 | + url: jdbc:sqlite::resource:wvp.sqlite | ||
| 30 | + username: | ||
| 31 | + password: | ||
| 32 | + type: com.alibaba.druid.pool.DruidDataSource | ||
| 33 | + driver-class-name: org.sqlite.JDBC | ||
| 34 | + max-active: 1 | ||
| 35 | + min-idle: 1 | ||
| 36 | + | ||
| 37 | +# [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 | ||
| 38 | +server: | ||
| 39 | + port: 18080 | ||
| 40 | + # [可选] HTTPS配置, 默认不开启 | ||
| 41 | + ssl: | ||
| 42 | + # [可选] 是否开启HTTPS访问 | ||
| 43 | + enabled: false | ||
| 44 | + # [可选] 证书文件路径,放置在resource/目录下即可,修改xxx为文件名 | ||
| 45 | + key-store: classpath:xxx.jks | ||
| 46 | + # [可选] 证书密码 | ||
| 47 | + key-password: password | ||
| 48 | + # [可选] 证书类型, 默认为jks,根据实际修改 | ||
| 49 | + key-store-type: JKS | ||
| 50 | + | ||
| 51 | +# 作为28181服务器的配置 | ||
| 52 | +sip: | ||
| 53 | + # [必须修改] 本机的IP, 必须是网卡上的IP,用于sip下协议栈监听ip,如果监听所有设置为0.0.0.0 | ||
| 54 | + monitorIp: 0.0.0.0 | ||
| 55 | + # [必须修改] 本机的IP | ||
| 56 | + ip: 192.168.0.100 | ||
| 57 | + # [可选] 28181服务监听的端口 | ||
| 58 | + port: 5060 | ||
| 59 | + # 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007) | ||
| 60 | + # 后两位为行业编码,定义参照附录D.3 | ||
| 61 | + # 3701020049标识山东济南历下区 信息行业接入 | ||
| 62 | + # [可选] | ||
| 63 | + domain: 4401020049 | ||
| 64 | + # [可选] | ||
| 65 | + id: 44010200492000000001 | ||
| 66 | + # [可选] 默认设备认证密码,后续扩展使用设备单独密码 | ||
| 67 | + password: admin123 | ||
| 68 | + | ||
| 69 | +#zlm服务器配置 | ||
| 70 | +media: | ||
| 71 | + # [必须修改] 本机的IP, 必须是网卡上的IP,用于sip下协议栈监听ip,如果监听所有设置为0.0.0.0 | ||
| 72 | + monitorIp: 0.0.0.0 | ||
| 73 | + # [必须修改] zlm服务器的内网IP | ||
| 74 | + ip: 192.168.0.100 | ||
| 75 | + # [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip | ||
| 76 | + sdpIp: | ||
| 77 | + # [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip | ||
| 78 | + hookIp: | ||
| 79 | + # [必须修改] zlm服务器的http.port | ||
| 80 | + httpPort: 80 | ||
| 81 | + # [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置 | ||
| 82 | + httpSSlPort: | ||
| 83 | + # [可选] zlm服务器的rtmp.port, 置空使用zlm配置文件配置 | ||
| 84 | + rtmpPort: | ||
| 85 | + # [可选] zlm服务器的rtmp.sslport, 置空使用zlm配置文件配置 | ||
| 86 | + rtmpSSlPort: | ||
| 87 | + # [可选] zlm服务器的 rtp_proxy.port, 置空使用zlm配置文件配置 | ||
| 88 | + rtpProxyPort: | ||
| 89 | + # [可选] zlm服务器的 rtsp.port, 置空使用zlm配置文件配置 | ||
| 90 | + rtspPort: | ||
| 91 | + # [可选] zlm服务器的 rtsp.sslport, 置空使用zlm配置文件配置 | ||
| 92 | + rtspSSLPort: | ||
| 93 | + # [可选] 是否自动配置ZLM, 如果希望手动配置ZLM, 可以设为false, 不建议新接触的用户修改 | ||
| 94 | + autoConfig: true | ||
| 95 | + # [可选] zlm服务器的hook.admin_params=secret | ||
| 96 | + secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc | ||
| 97 | + # [可选] zlm服务器的general.streamNoneReaderDelayMS | ||
| 98 | + streamNoneReaderDelayMS: 18000 # 无人观看多久自动关闭流, -1表示永不自动关闭,即 关闭按需拉流 | ||
| 99 | + # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 | ||
| 100 | + rtp: | ||
| 101 | + # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 | ||
| 102 | + enable: true | ||
| 103 | + # [可选] 在此范围内选择端口用于媒体流传输, | ||
| 104 | + portRange: 30000,30500 # 端口范围 | ||
| 105 | + # 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用 | ||
| 106 | + recordAssistPort: 0 | ||
| 107 | + | ||
| 108 | +# [可选] 日志配置, 一般不需要改 | ||
| 109 | +logging: | ||
| 110 | + file: | ||
| 111 | + name: logs/wvp.log | ||
| 112 | + max-history: 30 | ||
| 113 | + max-size: 10MB | ||
| 114 | + total-size-cap: 300MB | ||
| 115 | + level: | ||
| 116 | + com: | ||
| 117 | + genersoft: | ||
| 118 | + iot: info | ||
| 119 | +# [根据业务需求配置] | ||
| 120 | +userSettings: | ||
| 121 | + # [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true | ||
| 122 | + autoApplyPlay: false | ||
| 123 | + # [可选] 部分设备需要扩展SDP,需要打开此设置 | ||
| 124 | + seniorSdp: false | ||
| 125 | + # 保存移动位置历史轨迹:true:保留历史数据,false:仅保留最后的位置(默认) | ||
| 126 | + savePositionHistory: false | ||
| 127 | + # 点播等待超时时间,单位:毫秒 | ||
| 128 | + playTimeout: 3000 | ||
| 129 | + # 等待音视频编码信息再返回, true: 可以根据编码选择合适的播放器,false: 可以更快点播 | ||
| 130 | + waitTrack: false | ||
| 131 | + # 是否开启接口鉴权 | ||
| 132 | + interfaceAuthentication: true | ||
| 133 | + # 推流直播是否录制 | ||
| 134 | + recordPushLive: true | ||
| 135 | + | ||
| 136 | +# 在线文档: swagger-ui(生产环境建议关闭) | ||
| 137 | +springfox: | ||
| 138 | + documentation: | ||
| 139 | + swagger-ui: | ||
| 140 | + enabled: true | ||
| 0 | \ No newline at end of file | 141 | \ No newline at end of file |
src/main/resources/application-dev.yml
| @@ -13,12 +13,6 @@ spring: | @@ -13,12 +13,6 @@ spring: | ||
| 13 | timeout: 10000 | 13 | timeout: 10000 |
| 14 | # [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置 | 14 | # [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置 |
| 15 | datasource: | 15 | datasource: |
| 16 | - # name: wvp | ||
| 17 | - # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true | ||
| 18 | - # username: | ||
| 19 | - # password: | ||
| 20 | - # type: com.alibaba.druid.pool.DruidDataSource | ||
| 21 | - # driver-class-name: com.mysql.cj.jdbc.Driver | ||
| 22 | name: eiot | 16 | name: eiot |
| 23 | url: jdbc:sqlite::resource:wvp.sqlite | 17 | url: jdbc:sqlite::resource:wvp.sqlite |
| 24 | username: | 18 | username: |
| @@ -31,20 +25,10 @@ spring: | @@ -31,20 +25,10 @@ spring: | ||
| 31 | # [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 | 25 | # [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 |
| 32 | server: | 26 | server: |
| 33 | port: 18080 | 27 | port: 18080 |
| 34 | - # [可选] HTTPS配置, 默认不开启 | ||
| 35 | - ssl: | ||
| 36 | - # [可选] 是否开启HTTPS访问 | ||
| 37 | - enabled: false | ||
| 38 | - # [可选] 证书文件路径,放置在resource/目录下即可,修改xxx为文件名 | ||
| 39 | - key-store: classpath:xxx.jks | ||
| 40 | - # [可选] 证书密码 | ||
| 41 | - key-password: password | ||
| 42 | - # [可选] 证书类型, 默认为jks,根据实际修改 | ||
| 43 | - key-store-type: JKS | ||
| 44 | 28 | ||
| 45 | # 作为28181服务器的配置 | 29 | # 作为28181服务器的配置 |
| 46 | sip: | 30 | sip: |
| 47 | - # [必须修改] 本机的IP, 必须是网卡上的IP | 31 | + # [必须修改] 本机的IP |
| 48 | ip: 192.168.0.100 | 32 | ip: 192.168.0.100 |
| 49 | # [可选] 28181服务监听的端口 | 33 | # [可选] 28181服务监听的端口 |
| 50 | port: 5060 | 34 | port: 5060 |
| @@ -62,30 +46,10 @@ sip: | @@ -62,30 +46,10 @@ sip: | ||
| 62 | media: | 46 | media: |
| 63 | # [必须修改] zlm服务器的内网IP | 47 | # [必须修改] zlm服务器的内网IP |
| 64 | ip: 192.168.0.100 | 48 | ip: 192.168.0.100 |
| 65 | - # [可选] zlm服务器的公网IP, 内网部署置空即可 | ||
| 66 | - wanIp: | ||
| 67 | - # [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip | ||
| 68 | - hookIp: | ||
| 69 | # [必须修改] zlm服务器的http.port | 49 | # [必须修改] zlm服务器的http.port |
| 70 | httpPort: 80 | 50 | httpPort: 80 |
| 71 | - # [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置 | ||
| 72 | - httpSSlPort: | ||
| 73 | - # [可选] zlm服务器的rtmp.port, 置空使用zlm配置文件配置 | ||
| 74 | - rtmpPort: | ||
| 75 | - # [可选] zlm服务器的rtmp.sslport, 置空使用zlm配置文件配置 | ||
| 76 | - rtmpSSlPort: | ||
| 77 | - # [可选] zlm服务器的 rtp_proxy.port, 置空使用zlm配置文件配置 | ||
| 78 | - rtpProxyPort: | ||
| 79 | - # [可选] zlm服务器的 rtsp.port, 置空使用zlm配置文件配置 | ||
| 80 | - rtspPort: | ||
| 81 | - # [可选] zlm服务器的 rtsp.sslport, 置空使用zlm配置文件配置 | ||
| 82 | - rtspSSLPort: | ||
| 83 | - # [可选] 是否自动配置ZLM, 如果希望手动配置ZLM, 可以设为false, 不建议新接触的用户修改 | ||
| 84 | - autoConfig: true | ||
| 85 | # [可选] zlm服务器的hook.admin_params=secret | 51 | # [可选] zlm服务器的hook.admin_params=secret |
| 86 | secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc | 52 | secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc |
| 87 | - # [可选] zlm服务器的general.streamNoneReaderDelayMS | ||
| 88 | - streamNoneReaderDelayMS: 18000 # 无人观看多久自动关闭流, -1表示永不自动关闭,即 关闭按需拉流 | ||
| 89 | # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 | 53 | # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 |
| 90 | rtp: | 54 | rtp: |
| 91 | # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 | 55 | # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 |
| @@ -95,29 +59,10 @@ media: | @@ -95,29 +59,10 @@ media: | ||
| 95 | # 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用 | 59 | # 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用 |
| 96 | recordAssistPort: 0 | 60 | recordAssistPort: 0 |
| 97 | 61 | ||
| 98 | -# [可选] 日志配置, 一般不需要改 | ||
| 99 | -logging: | ||
| 100 | - file: | ||
| 101 | - name: logs/wvp.log | ||
| 102 | - max-history: 30 | ||
| 103 | - max-size: 10MB | ||
| 104 | - total-size-cap: 300MB | ||
| 105 | - level: | ||
| 106 | - com: | ||
| 107 | - genersoft: | ||
| 108 | - iot: info | ||
| 109 | # [根据业务需求配置] | 62 | # [根据业务需求配置] |
| 110 | userSettings: | 63 | userSettings: |
| 111 | # [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true | 64 | # [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true |
| 112 | autoApplyPlay: false | 65 | autoApplyPlay: false |
| 113 | - # [可选] 部分设备需要扩展SDP,需要打开此设置 | ||
| 114 | - seniorSdp: false | ||
| 115 | - # 保存移动位置历史轨迹:true:保留历史数据,false:仅保留最后的位置(默认) | ||
| 116 | - savePositionHistory: false | ||
| 117 | - # 点播等待超时时间,单位:毫秒 | ||
| 118 | - playTimeout: 3000 | ||
| 119 | - # 等待音视频编码信息再返回, true: 可以根据编码选择合适的播放器,false: 可以更快点播 | ||
| 120 | - waitTrack: false | ||
| 121 | # 是否开启接口鉴权 | 66 | # 是否开启接口鉴权 |
| 122 | interfaceAuthentication: true | 67 | interfaceAuthentication: true |
| 123 | # 推流直播是否录制 | 68 | # 推流直播是否录制 |
| @@ -127,4 +72,16 @@ userSettings: | @@ -127,4 +72,16 @@ userSettings: | ||
| 127 | springfox: | 72 | springfox: |
| 128 | documentation: | 73 | documentation: |
| 129 | swagger-ui: | 74 | swagger-ui: |
| 130 | - enabled: true | ||
| 131 | \ No newline at end of file | 75 | \ No newline at end of file |
| 76 | + enabled: true | ||
| 77 | + | ||
| 78 | +# [可选] 日志配置, 一般不需要改 | ||
| 79 | +logging: | ||
| 80 | + file: | ||
| 81 | + name: logs/wvp.log | ||
| 82 | + max-history: 30 | ||
| 83 | + max-size: 10MB | ||
| 84 | + total-size-cap: 300MB | ||
| 85 | + level: | ||
| 86 | + com: | ||
| 87 | + genersoft: | ||
| 88 | + iot: info | ||
| 132 | \ No newline at end of file | 89 | \ No newline at end of file |
web_src/src/components/dialog/devicePlayer.vue
| @@ -270,11 +270,18 @@ export default { | @@ -270,11 +270,18 @@ export default { | ||
| 270 | this.hasaudio = hasAudio; | 270 | this.hasaudio = hasAudio; |
| 271 | this.isLoging = false; | 271 | this.isLoging = false; |
| 272 | // this.videoUrl = streamInfo.rtc; | 272 | // this.videoUrl = streamInfo.rtc; |
| 273 | - this.videoUrl = streamInfo.ws_flv; | 273 | + this.videoUrl = this.getUrlByStreamInfo(streamInfo); |
| 274 | this.streamId = streamInfo.streamId; | 274 | this.streamId = streamInfo.streamId; |
| 275 | this.app = streamInfo.app; | 275 | this.app = streamInfo.app; |
| 276 | this.playFromStreamInfo(false, streamInfo) | 276 | this.playFromStreamInfo(false, streamInfo) |
| 277 | }, | 277 | }, |
| 278 | + getUrlByStreamInfo(streamInfo){ | ||
| 279 | + let baseZlmApi = process.env.NODE_ENV === 'development'?`${location.host}/debug/zlm`:`${location.host}/zlm` | ||
| 280 | + console.log(12121212) | ||
| 281 | + console.log(baseZlmApi) | ||
| 282 | + // return `${baseZlmApi}/${streamInfo.app}/${streamInfo.streamId}.flv`; | ||
| 283 | + return `http://${baseZlmApi}/${streamInfo.app}/${streamInfo.streamId}.flv`; | ||
| 284 | + }, | ||
| 278 | coverPlay: function () { | 285 | coverPlay: function () { |
| 279 | var that = this; | 286 | var that = this; |
| 280 | this.coverPlaying = true; | 287 | this.coverPlaying = true; |
| @@ -335,7 +342,7 @@ export default { | @@ -335,7 +342,7 @@ export default { | ||
| 335 | playFromStreamInfo: function (realHasAudio, streamInfo) { | 342 | playFromStreamInfo: function (realHasAudio, streamInfo) { |
| 336 | this.showVideoDialog = true; | 343 | this.showVideoDialog = true; |
| 337 | this.hasaudio = realHasAudio && this.hasaudio; | 344 | this.hasaudio = realHasAudio && this.hasaudio; |
| 338 | - this.$refs.videoPlayer.play(streamInfo.ws_flv) | 345 | + this.$refs.videoPlayer.play(this.getUrlByStreamInfo(streamInfo)) |
| 339 | }, | 346 | }, |
| 340 | close: function () { | 347 | close: function () { |
| 341 | console.log('关闭视频'); | 348 | console.log('关闭视频'); |
| @@ -418,7 +425,7 @@ export default { | @@ -418,7 +425,7 @@ export default { | ||
| 418 | }).then(function (res) { | 425 | }).then(function (res) { |
| 419 | var streamInfo = res.data; | 426 | var streamInfo = res.data; |
| 420 | that.streamId = streamInfo.streamId; | 427 | that.streamId = streamInfo.streamId; |
| 421 | - that.videoUrl = streamInfo.ws_flv; | 428 | + that.videoUrl = this.getUrlByStreamInfo(streamInfo); |
| 422 | that.recordPlay = true; | 429 | that.recordPlay = true; |
| 423 | }); | 430 | }); |
| 424 | } | 431 | } |
web_src/src/main.js
| @@ -55,7 +55,6 @@ axios.interceptors.response.use(function (response) { | @@ -55,7 +55,6 @@ axios.interceptors.response.use(function (response) { | ||
| 55 | 55 | ||
| 56 | Vue.prototype.$cookies.config(60*30); | 56 | Vue.prototype.$cookies.config(60*30); |
| 57 | 57 | ||
| 58 | - | ||
| 59 | new Vue({ | 58 | new Vue({ |
| 60 | router: router, | 59 | router: router, |
| 61 | render: h => h(App), | 60 | render: h => h(App), |