Commit 3b1516afe54cfa95a37b3356e7910c7ad57b32db

Authored by 648540858
1 parent 4f22994c

优化录像配置。不再使用zlm默认的http服务器

src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java
@@ -169,7 +169,10 @@ public class ProxyServletConfig { @@ -169,7 +169,10 @@ public class ProxyServletConfig {
169 protected String rewriteQueryStringFromRequest(HttpServletRequest servletRequest, String queryString) { 169 protected String rewriteQueryStringFromRequest(HttpServletRequest servletRequest, String queryString) {
170 String queryStr = super.rewriteQueryStringFromRequest(servletRequest, queryString); 170 String queryStr = super.rewriteQueryStringFromRequest(servletRequest, queryString);
171 MediaServerItem mediaInfo = getMediaInfoByUri(servletRequest.getRequestURI()); 171 MediaServerItem mediaInfo = getMediaInfoByUri(servletRequest.getRequestURI());
172 - String remoteHost = String.format("http://%s:%s", mediaInfo.getStreamIp(), mediaInfo.getHttpPort()); 172 + if (mediaInfo == null) {
  173 + return null;
  174 + }
  175 + String remoteHost = String.format("http://%s:%s", mediaInfo.getStreamIp(), mediaInfo.getRecordAssistPort());
173 if (!ObjectUtils.isEmpty(queryStr)) { 176 if (!ObjectUtils.isEmpty(queryStr)) {
174 queryStr += "&remoteHost=" + remoteHost; 177 queryStr += "&remoteHost=" + remoteHost;
175 }else { 178 }else {
src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
@@ -54,6 +54,8 @@ public class UserSetting { @@ -54,6 +54,8 @@ public class UserSetting {
54 54
55 private String serverId = "000000"; 55 private String serverId = "000000";
56 56
  57 + private String recordPath = null;
  58 +
57 private String thirdPartyGBIdReg = "[\\s\\S]*"; 59 private String thirdPartyGBIdReg = "[\\s\\S]*";
58 60
59 private List<String> interfaceAuthenticationExcludes = new ArrayList<>(); 61 private List<String> interfaceAuthenticationExcludes = new ArrayList<>();
@@ -248,5 +250,11 @@ public class UserSetting { @@ -248,5 +250,11 @@ public class UserSetting {
248 this.refuseChannelStatusChannelFormNotify = refuseChannelStatusChannelFormNotify; 250 this.refuseChannelStatusChannelFormNotify = refuseChannelStatusChannelFormNotify;
249 } 251 }
250 252
  253 + public String getRecordPath() {
  254 + return recordPath;
  255 + }
251 256
  257 + public void setRecordPath(String recordPath) {
  258 + this.recordPath = recordPath;
  259 + }
252 } 260 }
src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java
@@ -9,17 +9,12 @@ import org.jetbrains.annotations.NotNull; @@ -9,17 +9,12 @@ import org.jetbrains.annotations.NotNull;
9 import org.slf4j.Logger; 9 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
11 import org.springframework.stereotype.Component; 11 import org.springframework.stereotype.Component;
12 -import org.springframework.util.ObjectUtils;  
13 -import org.springframework.util.StringUtils;  
14 12
15 -import java.io.File;  
16 -import java.io.FileOutputStream;  
17 import java.io.IOException; 13 import java.io.IOException;
18 import java.net.ConnectException; 14 import java.net.ConnectException;
19 import java.util.HashMap; 15 import java.util.HashMap;
20 import java.util.Map; 16 import java.util.Map;
21 import java.util.Objects; 17 import java.util.Objects;
22 -import java.util.concurrent.TimeUnit;  
23 18
24 @Component 19 @Component
25 public class AssistRESTfulUtils { 20 public class AssistRESTfulUtils {
@@ -137,6 +132,11 @@ public class AssistRESTfulUtils { @@ -137,6 +132,11 @@ public class AssistRESTfulUtils {
137 return sendGet(mediaServerItem, "api/record/file/duration",param, callback); 132 return sendGet(mediaServerItem, "api/record/file/duration",param, callback);
138 } 133 }
139 134
  135 + public JSONObject getInfo(MediaServerItem mediaServerItem, RequestCallback callback){
  136 + Map<String, Object> param = new HashMap<>();
  137 + return sendGet(mediaServerItem, "api/record/info",param, callback);
  138 + }
  139 +
140 public JSONObject addStreamCallInfo(MediaServerItem mediaServerItem, String app, String stream, String callId, RequestCallback callback){ 140 public JSONObject addStreamCallInfo(MediaServerItem mediaServerItem, String app, String stream, String callId, RequestCallback callback){
141 Map<String, Object> param = new HashMap<>(); 141 Map<String, Object> param = new HashMap<>();
142 param.put("app",app); 142 param.put("app",app);
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -253,6 +253,24 @@ public class ZLMHttpHookListener { @@ -253,6 +253,24 @@ public class ZLMHttpHookListener {
253 result.setEnable_mp4(true); 253 result.setEnable_mp4(true);
254 } 254 }
255 } 255 }
  256 + if (mediaInfo.getRecordAssistPort() > 0 && userSetting.getRecordPath() == null) {
  257 + logger.info("推流时发现尚未设置录像路径,从assist服务中读取");
  258 + JSONObject info = assistRESTfulUtils.getInfo(mediaInfo, null);
  259 + if (info != null && info.getInteger("code") != null && info.getInteger("code") == 0 ) {
  260 + JSONObject dataJson = info.getJSONObject("data");
  261 + if (dataJson != null) {
  262 + String recordPath = dataJson.getString("record");
  263 + userSetting.setRecordPath(recordPath);
  264 + result.setMp4_save_path(recordPath);
  265 + // 修改zlm中的录像路径
  266 + if (mediaInfo.isAutoConfig()) {
  267 + taskExecutor.execute(() -> {
  268 + mediaServerService.setZLMConfig(mediaInfo, false);
  269 + });
  270 + }
  271 + }
  272 + }
  273 + }
256 return result; 274 return result;
257 } 275 }
258 276
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java
@@ -10,21 +10,87 @@ public class ZLMServerConfig { @@ -10,21 +10,87 @@ public class ZLMServerConfig {
10 @JSONField(name = "api.secret") 10 @JSONField(name = "api.secret")
11 private String apiSecret; 11 private String apiSecret;
12 12
  13 + @JSONField(name = "api.snapRoot")
  14 + private String apiSnapRoot;
  15 +
  16 + @JSONField(name = "api.defaultSnap")
  17 + private String apiDefaultSnap;
  18 +
13 @JSONField(name = "ffmpeg.bin") 19 @JSONField(name = "ffmpeg.bin")
14 private String ffmpegBin; 20 private String ffmpegBin;
15 21
16 @JSONField(name = "ffmpeg.cmd") 22 @JSONField(name = "ffmpeg.cmd")
17 private String ffmpegCmd; 23 private String ffmpegCmd;
18 24
  25 + @JSONField(name = "ffmpeg.snap")
  26 + private String ffmpegSnap;
  27 +
19 @JSONField(name = "ffmpeg.log") 28 @JSONField(name = "ffmpeg.log")
20 private String ffmpegLog; 29 private String ffmpegLog;
21 30
  31 + @JSONField(name = "ffmpeg.restart_sec")
  32 + private String ffmpegRestartSec;
  33 +
  34 + @JSONField(name = "protocol.modify_stamp")
  35 + private String protocolModifyStamp;
  36 +
  37 + @JSONField(name = "protocol.enable_audio")
  38 + private String protocolEnableAudio;
  39 +
  40 + @JSONField(name = "protocol.add_mute_audio")
  41 + private String protocolAddMuteAudio;
  42 +
  43 + @JSONField(name = "protocol.continue_push_ms")
  44 + private String protocolContinuePushMs;
  45 +
  46 + @JSONField(name = "protocol.enable_hls")
  47 + private String protocolEnableHls;
  48 +
  49 + @JSONField(name = "protocol.enable_mp4")
  50 + private String protocolEnableMp4;
  51 +
  52 + @JSONField(name = "protocol.enable_rtsp")
  53 + private String protocolEnableRtsp;
  54 +
  55 + @JSONField(name = "protocol.enable_rtmp")
  56 + private String protocolEnableRtmp;
  57 +
  58 + @JSONField(name = "protocol.enable_ts")
  59 + private String protocolEnableTs;
  60 +
  61 + @JSONField(name = "protocol.enable_fmp4")
  62 + private String protocolEnableFmp4;
  63 +
  64 + @JSONField(name = "protocol.mp4_as_player")
  65 + private String protocolMp4AsPlayer;
  66 +
  67 + @JSONField(name = "protocol.mp4_max_second")
  68 + private String protocolMp4MaxSecond;
  69 +
  70 + @JSONField(name = "protocol.mp4_save_path")
  71 + private String protocolMp4SavePath;
  72 +
  73 + @JSONField(name = "protocol.hls_save_path")
  74 + private String protocolHlsSavePath;
  75 +
  76 + @JSONField(name = "protocol.hls_demand")
  77 + private String protocolHlsDemand;
  78 +
  79 + @JSONField(name = "protocol.rtsp_demand")
  80 + private String protocolRtspDemand;
  81 +
  82 + @JSONField(name = "protocol.rtmp_demand")
  83 + private String protocolRtmpDemand;
  84 +
  85 + @JSONField(name = "protocol.ts_demand")
  86 + private String protocolTsDemand;
  87 +
  88 + @JSONField(name = "protocol.fmp4_demand")
  89 + private String protocolFmp4Demand;
  90 +
22 @JSONField(name = "general.enableVhost") 91 @JSONField(name = "general.enableVhost")
23 private String generalEnableVhost; 92 private String generalEnableVhost;
24 93
25 - @JSONField(name = "general.mediaServerId")  
26 - private String generalMediaServerId;  
27 -  
28 @JSONField(name = "general.flowThreshold") 94 @JSONField(name = "general.flowThreshold")
29 private String generalFlowThreshold; 95 private String generalFlowThreshold;
30 96
@@ -34,6 +100,25 @@ public class ZLMServerConfig { @@ -34,6 +100,25 @@ public class ZLMServerConfig {
34 @JSONField(name = "general.streamNoneReaderDelayMS") 100 @JSONField(name = "general.streamNoneReaderDelayMS")
35 private int generalStreamNoneReaderDelayMS; 101 private int generalStreamNoneReaderDelayMS;
36 102
  103 + @JSONField(name = "general.resetWhenRePlay")
  104 + private String generalResetWhenRePlay;
  105 +
  106 + @JSONField(name = "general.mergeWriteMS")
  107 + private String generalMergeWriteMS;
  108 +
  109 + @JSONField(name = "general.mediaServerId")
  110 + private String generalMediaServerId;
  111 +
  112 + @JSONField(name = "general.wait_track_ready_ms")
  113 + private String generalWaitTrackReadyMs;
  114 +
  115 + @JSONField(name = "general.wait_add_track_ms")
  116 + private String generalWaitAddTrackMs;
  117 +
  118 + @JSONField(name = "general.unready_frame_cache")
  119 + private String generalUnreadyFrameCache;
  120 +
  121 +
37 @JSONField(name = "ip") 122 @JSONField(name = "ip")
38 private String ip; 123 private String ip;
39 124
@@ -59,6 +144,18 @@ public class ZLMServerConfig { @@ -59,6 +144,18 @@ public class ZLMServerConfig {
59 @JSONField(name = "hls.segNum") 144 @JSONField(name = "hls.segNum")
60 private String hlsSegNum; 145 private String hlsSegNum;
61 146
  147 + @JSONField(name = "hls.segRetain")
  148 + private String hlsSegRetain;
  149 +
  150 + @JSONField(name = "hls.broadcastRecordTs")
  151 + private String hlsBroadcastRecordTs;
  152 +
  153 + @JSONField(name = "hls.deleteDelaySec")
  154 + private String hlsDeleteDelaySec;
  155 +
  156 + @JSONField(name = "hls.segKeep")
  157 + private String hlsSegKeep;
  158 +
62 @JSONField(name = "hook.access_file_except_hls") 159 @JSONField(name = "hook.access_file_except_hls")
63 private String hookAccessFileExceptHLS; 160 private String hookAccessFileExceptHLS;
64 161
@@ -104,6 +201,18 @@ public class ZLMServerConfig { @@ -104,6 +201,18 @@ public class ZLMServerConfig {
104 @JSONField(name = "hook.on_stream_not_found") 201 @JSONField(name = "hook.on_stream_not_found")
105 private String hookOnStreamNotFound; 202 private String hookOnStreamNotFound;
106 203
  204 + @JSONField(name = "hook.on_server_started")
  205 + private String hookOnServerStarted;
  206 +
  207 + @JSONField(name = "hook.on_server_keepalive")
  208 + private String hookOnServerKeepalive;
  209 +
  210 + @JSONField(name = "hook.on_send_rtp_stopped")
  211 + private String hookOnSendRtpStopped;
  212 +
  213 + @JSONField(name = "hook.on_rtp_server_timeout")
  214 + private String hookOnRtpServerTimeout;
  215 +
107 @JSONField(name = "hook.timeoutSec") 216 @JSONField(name = "hook.timeoutSec")
108 private String hookTimeoutSec; 217 private String hookTimeoutSec;
109 218
@@ -813,4 +922,292 @@ public class ZLMServerConfig { @@ -813,4 +922,292 @@ public class ZLMServerConfig {
813 public void setPortRange(String portRange) { 922 public void setPortRange(String portRange) {
814 this.portRange = portRange; 923 this.portRange = portRange;
815 } 924 }
  925 +
  926 + public String getApiSnapRoot() {
  927 + return apiSnapRoot;
  928 + }
  929 +
  930 + public void setApiSnapRoot(String apiSnapRoot) {
  931 + this.apiSnapRoot = apiSnapRoot;
  932 + }
  933 +
  934 + public String getApiDefaultSnap() {
  935 + return apiDefaultSnap;
  936 + }
  937 +
  938 + public void setApiDefaultSnap(String apiDefaultSnap) {
  939 + this.apiDefaultSnap = apiDefaultSnap;
  940 + }
  941 +
  942 + public String getFfmpegSnap() {
  943 + return ffmpegSnap;
  944 + }
  945 +
  946 + public void setFfmpegSnap(String ffmpegSnap) {
  947 + this.ffmpegSnap = ffmpegSnap;
  948 + }
  949 +
  950 + public String getFfmpegRestartSec() {
  951 + return ffmpegRestartSec;
  952 + }
  953 +
  954 + public void setFfmpegRestartSec(String ffmpegRestartSec) {
  955 + this.ffmpegRestartSec = ffmpegRestartSec;
  956 + }
  957 +
  958 + public String getProtocolModifyStamp() {
  959 + return protocolModifyStamp;
  960 + }
  961 +
  962 + public void setProtocolModifyStamp(String protocolModifyStamp) {
  963 + this.protocolModifyStamp = protocolModifyStamp;
  964 + }
  965 +
  966 + public String getProtocolEnableAudio() {
  967 + return protocolEnableAudio;
  968 + }
  969 +
  970 + public void setProtocolEnableAudio(String protocolEnableAudio) {
  971 + this.protocolEnableAudio = protocolEnableAudio;
  972 + }
  973 +
  974 + public String getProtocolAddMuteAudio() {
  975 + return protocolAddMuteAudio;
  976 + }
  977 +
  978 + public void setProtocolAddMuteAudio(String protocolAddMuteAudio) {
  979 + this.protocolAddMuteAudio = protocolAddMuteAudio;
  980 + }
  981 +
  982 + public String getProtocolContinuePushMs() {
  983 + return protocolContinuePushMs;
  984 + }
  985 +
  986 + public void setProtocolContinuePushMs(String protocolContinuePushMs) {
  987 + this.protocolContinuePushMs = protocolContinuePushMs;
  988 + }
  989 +
  990 + public String getProtocolEnableHls() {
  991 + return protocolEnableHls;
  992 + }
  993 +
  994 + public void setProtocolEnableHls(String protocolEnableHls) {
  995 + this.protocolEnableHls = protocolEnableHls;
  996 + }
  997 +
  998 + public String getProtocolEnableMp4() {
  999 + return protocolEnableMp4;
  1000 + }
  1001 +
  1002 + public void setProtocolEnableMp4(String protocolEnableMp4) {
  1003 + this.protocolEnableMp4 = protocolEnableMp4;
  1004 + }
  1005 +
  1006 + public String getProtocolEnableRtsp() {
  1007 + return protocolEnableRtsp;
  1008 + }
  1009 +
  1010 + public void setProtocolEnableRtsp(String protocolEnableRtsp) {
  1011 + this.protocolEnableRtsp = protocolEnableRtsp;
  1012 + }
  1013 +
  1014 + public String getProtocolEnableRtmp() {
  1015 + return protocolEnableRtmp;
  1016 + }
  1017 +
  1018 + public void setProtocolEnableRtmp(String protocolEnableRtmp) {
  1019 + this.protocolEnableRtmp = protocolEnableRtmp;
  1020 + }
  1021 +
  1022 + public String getProtocolEnableTs() {
  1023 + return protocolEnableTs;
  1024 + }
  1025 +
  1026 + public void setProtocolEnableTs(String protocolEnableTs) {
  1027 + this.protocolEnableTs = protocolEnableTs;
  1028 + }
  1029 +
  1030 + public String getProtocolEnableFmp4() {
  1031 + return protocolEnableFmp4;
  1032 + }
  1033 +
  1034 + public void setProtocolEnableFmp4(String protocolEnableFmp4) {
  1035 + this.protocolEnableFmp4 = protocolEnableFmp4;
  1036 + }
  1037 +
  1038 + public String getProtocolMp4AsPlayer() {
  1039 + return protocolMp4AsPlayer;
  1040 + }
  1041 +
  1042 + public void setProtocolMp4AsPlayer(String protocolMp4AsPlayer) {
  1043 + this.protocolMp4AsPlayer = protocolMp4AsPlayer;
  1044 + }
  1045 +
  1046 + public String getProtocolMp4MaxSecond() {
  1047 + return protocolMp4MaxSecond;
  1048 + }
  1049 +
  1050 + public void setProtocolMp4MaxSecond(String protocolMp4MaxSecond) {
  1051 + this.protocolMp4MaxSecond = protocolMp4MaxSecond;
  1052 + }
  1053 +
  1054 + public String getProtocolMp4SavePath() {
  1055 + return protocolMp4SavePath;
  1056 + }
  1057 +
  1058 + public void setProtocolMp4SavePath(String protocolMp4SavePath) {
  1059 + this.protocolMp4SavePath = protocolMp4SavePath;
  1060 + }
  1061 +
  1062 + public String getProtocolHlsSavePath() {
  1063 + return protocolHlsSavePath;
  1064 + }
  1065 +
  1066 + public void setProtocolHlsSavePath(String protocolHlsSavePath) {
  1067 + this.protocolHlsSavePath = protocolHlsSavePath;
  1068 + }
  1069 +
  1070 + public String getProtocolHlsDemand() {
  1071 + return protocolHlsDemand;
  1072 + }
  1073 +
  1074 + public void setProtocolHlsDemand(String protocolHlsDemand) {
  1075 + this.protocolHlsDemand = protocolHlsDemand;
  1076 + }
  1077 +
  1078 + public String getProtocolRtspDemand() {
  1079 + return protocolRtspDemand;
  1080 + }
  1081 +
  1082 + public void setProtocolRtspDemand(String protocolRtspDemand) {
  1083 + this.protocolRtspDemand = protocolRtspDemand;
  1084 + }
  1085 +
  1086 + public String getProtocolRtmpDemand() {
  1087 + return protocolRtmpDemand;
  1088 + }
  1089 +
  1090 + public void setProtocolRtmpDemand(String protocolRtmpDemand) {
  1091 + this.protocolRtmpDemand = protocolRtmpDemand;
  1092 + }
  1093 +
  1094 + public String getProtocolTsDemand() {
  1095 + return protocolTsDemand;
  1096 + }
  1097 +
  1098 + public void setProtocolTsDemand(String protocolTsDemand) {
  1099 + this.protocolTsDemand = protocolTsDemand;
  1100 + }
  1101 +
  1102 + public String getProtocolFmp4Demand() {
  1103 + return protocolFmp4Demand;
  1104 + }
  1105 +
  1106 + public void setProtocolFmp4Demand(String protocolFmp4Demand) {
  1107 + this.protocolFmp4Demand = protocolFmp4Demand;
  1108 + }
  1109 +
  1110 + public String getGeneralResetWhenRePlay() {
  1111 + return generalResetWhenRePlay;
  1112 + }
  1113 +
  1114 + public void setGeneralResetWhenRePlay(String generalResetWhenRePlay) {
  1115 + this.generalResetWhenRePlay = generalResetWhenRePlay;
  1116 + }
  1117 +
  1118 + public String getGeneralMergeWriteMS() {
  1119 + return generalMergeWriteMS;
  1120 + }
  1121 +
  1122 + public void setGeneralMergeWriteMS(String generalMergeWriteMS) {
  1123 + this.generalMergeWriteMS = generalMergeWriteMS;
  1124 + }
  1125 +
  1126 + public String getGeneralWaitTrackReadyMs() {
  1127 + return generalWaitTrackReadyMs;
  1128 + }
  1129 +
  1130 + public void setGeneralWaitTrackReadyMs(String generalWaitTrackReadyMs) {
  1131 + this.generalWaitTrackReadyMs = generalWaitTrackReadyMs;
  1132 + }
  1133 +
  1134 + public String getGeneralWaitAddTrackMs() {
  1135 + return generalWaitAddTrackMs;
  1136 + }
  1137 +
  1138 + public void setGeneralWaitAddTrackMs(String generalWaitAddTrackMs) {
  1139 + this.generalWaitAddTrackMs = generalWaitAddTrackMs;
  1140 + }
  1141 +
  1142 + public String getGeneralUnreadyFrameCache() {
  1143 + return generalUnreadyFrameCache;
  1144 + }
  1145 +
  1146 + public void setGeneralUnreadyFrameCache(String generalUnreadyFrameCache) {
  1147 + this.generalUnreadyFrameCache = generalUnreadyFrameCache;
  1148 + }
  1149 +
  1150 + public String getHlsSegRetain() {
  1151 + return hlsSegRetain;
  1152 + }
  1153 +
  1154 + public void setHlsSegRetain(String hlsSegRetain) {
  1155 + this.hlsSegRetain = hlsSegRetain;
  1156 + }
  1157 +
  1158 + public String getHlsBroadcastRecordTs() {
  1159 + return hlsBroadcastRecordTs;
  1160 + }
  1161 +
  1162 + public void setHlsBroadcastRecordTs(String hlsBroadcastRecordTs) {
  1163 + this.hlsBroadcastRecordTs = hlsBroadcastRecordTs;
  1164 + }
  1165 +
  1166 + public String getHlsDeleteDelaySec() {
  1167 + return hlsDeleteDelaySec;
  1168 + }
  1169 +
  1170 + public void setHlsDeleteDelaySec(String hlsDeleteDelaySec) {
  1171 + this.hlsDeleteDelaySec = hlsDeleteDelaySec;
  1172 + }
  1173 +
  1174 + public String getHlsSegKeep() {
  1175 + return hlsSegKeep;
  1176 + }
  1177 +
  1178 + public void setHlsSegKeep(String hlsSegKeep) {
  1179 + this.hlsSegKeep = hlsSegKeep;
  1180 + }
  1181 +
  1182 + public String getHookOnServerStarted() {
  1183 + return hookOnServerStarted;
  1184 + }
  1185 +
  1186 + public void setHookOnServerStarted(String hookOnServerStarted) {
  1187 + this.hookOnServerStarted = hookOnServerStarted;
  1188 + }
  1189 +
  1190 + public String getHookOnServerKeepalive() {
  1191 + return hookOnServerKeepalive;
  1192 + }
  1193 +
  1194 + public void setHookOnServerKeepalive(String hookOnServerKeepalive) {
  1195 + this.hookOnServerKeepalive = hookOnServerKeepalive;
  1196 + }
  1197 +
  1198 + public String getHookOnSendRtpStopped() {
  1199 + return hookOnSendRtpStopped;
  1200 + }
  1201 +
  1202 + public void setHookOnSendRtpStopped(String hookOnSendRtpStopped) {
  1203 + this.hookOnSendRtpStopped = hookOnSendRtpStopped;
  1204 + }
  1205 +
  1206 + public String getHookOnRtpServerTimeout() {
  1207 + return hookOnRtpServerTimeout;
  1208 + }
  1209 +
  1210 + public void setHookOnRtpServerTimeout(String hookOnRtpServerTimeout) {
  1211 + this.hookOnRtpServerTimeout = hookOnRtpServerTimeout;
  1212 + }
816 } 1213 }
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookResultForOnPublish.java
@@ -5,6 +5,7 @@ public class HookResultForOnPublish extends HookResult{ @@ -5,6 +5,7 @@ public class HookResultForOnPublish extends HookResult{
5 private boolean enable_audio; 5 private boolean enable_audio;
6 private boolean enable_mp4; 6 private boolean enable_mp4;
7 private int mp4_max_second; 7 private int mp4_max_second;
  8 + private String mp4_save_path;
8 9
9 public HookResultForOnPublish() { 10 public HookResultForOnPublish() {
10 } 11 }
@@ -41,4 +42,12 @@ public class HookResultForOnPublish extends HookResult{ @@ -41,4 +42,12 @@ public class HookResultForOnPublish extends HookResult{
41 public void setMp4_max_second(int mp4_max_second) { 42 public void setMp4_max_second(int mp4_max_second) {
42 this.mp4_max_second = mp4_max_second; 43 this.mp4_max_second = mp4_max_second;
43 } 44 }
  45 +
  46 + public String getMp4_save_path() {
  47 + return mp4_save_path;
  48 + }
  49 +
  50 + public void setMp4_save_path(String mp4_save_path) {
  51 + this.mp4_save_path = mp4_save_path;
  52 + }
44 } 53 }
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
@@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.conf.exception.ControllerException; @@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.conf.exception.ControllerException;
11 import com.genersoft.iot.vmp.gb28181.event.EventPublisher; 11 import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
12 import com.genersoft.iot.vmp.gb28181.session.SsrcConfig; 12 import com.genersoft.iot.vmp.gb28181.session.SsrcConfig;
13 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; 13 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
  14 +import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils;
14 import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; 15 import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
15 import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; 16 import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
16 import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; 17 import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
@@ -38,6 +39,7 @@ import org.springframework.transaction.TransactionDefinition; @@ -38,6 +39,7 @@ import org.springframework.transaction.TransactionDefinition;
38 import org.springframework.transaction.TransactionStatus; 39 import org.springframework.transaction.TransactionStatus;
39 import org.springframework.util.ObjectUtils; 40 import org.springframework.util.ObjectUtils;
40 41
  42 +import java.io.File;
41 import java.time.LocalDateTime; 43 import java.time.LocalDateTime;
42 import java.util.*; 44 import java.util.*;
43 45
@@ -64,6 +66,9 @@ public class MediaServerServiceImpl implements IMediaServerService { @@ -64,6 +66,9 @@ public class MediaServerServiceImpl implements IMediaServerService {
64 private UserSetting userSetting; 66 private UserSetting userSetting;
65 67
66 @Autowired 68 @Autowired
  69 + private AssistRESTfulUtils assistRESTfulUtils;
  70 +
  71 + @Autowired
67 private ZLMRESTfulUtils zlmresTfulUtils; 72 private ZLMRESTfulUtils zlmresTfulUtils;
68 73
69 @Autowired 74 @Autowired
@@ -407,13 +412,27 @@ public class MediaServerServiceImpl implements IMediaServerService { @@ -407,13 +412,27 @@ public class MediaServerServiceImpl implements IMediaServerService {
407 } 412 }
408 RedisUtil.set(key, serverItem); 413 RedisUtil.set(key, serverItem);
409 resetOnlineServerItem(serverItem); 414 resetOnlineServerItem(serverItem);
  415 +
  416 +
410 if (serverItem.isAutoConfig()) { 417 if (serverItem.isAutoConfig()) {
  418 + // 查看assist服务的录像路径配置
  419 + if (serverItem.getRecordAssistPort() > 0 && userSetting.getRecordPath() == null) {
  420 + JSONObject info = assistRESTfulUtils.getInfo(serverItem, null);
  421 + if (info != null && info.getInteger("code") != null && info.getInteger("code") == 0 ) {
  422 + JSONObject dataJson = info.getJSONObject("data");
  423 + if (dataJson != null) {
  424 + String recordPath = dataJson.getString("record");
  425 + userSetting.setRecordPath(recordPath);
  426 + }
  427 + }
  428 + }
411 setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable())); 429 setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable()));
412 } 430 }
413 final String zlmKeepaliveKey = zlmKeepaliveKeyPrefix + serverItem.getId(); 431 final String zlmKeepaliveKey = zlmKeepaliveKeyPrefix + serverItem.getId();
414 dynamicTask.stop(zlmKeepaliveKey); 432 dynamicTask.stop(zlmKeepaliveKey);
415 dynamicTask.startDelay(zlmKeepaliveKey, new KeepAliveTimeoutRunnable(serverItem), (Math.getExponent(serverItem.getHookAliveInterval()) + 5) * 1000); 433 dynamicTask.startDelay(zlmKeepaliveKey, new KeepAliveTimeoutRunnable(serverItem), (Math.getExponent(serverItem.getHookAliveInterval()) + 5) * 1000);
416 publisher.zlmOnlineEventPublish(serverItem.getId()); 434 publisher.zlmOnlineEventPublish(serverItem.getId());
  435 +
417 logger.info("[ZLM] 连接成功 {} - {}:{} ", 436 logger.info("[ZLM] 连接成功 {} - {}:{} ",
418 zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort()); 437 zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort());
419 } 438 }
@@ -584,6 +603,13 @@ public class MediaServerServiceImpl implements IMediaServerService { @@ -584,6 +603,13 @@ public class MediaServerServiceImpl implements IMediaServerService {
584 param.put("rtp_proxy.port_range", mediaServerItem.getRtpPortRange().replace(",", "-")); 603 param.put("rtp_proxy.port_range", mediaServerItem.getRtpPortRange().replace(",", "-"));
585 } 604 }
586 605
  606 + if (userSetting.getRecordPath() != null) {
  607 + File recordPathFile = new File(userSetting.getRecordPath());
  608 + File mp4SavePathFile = recordPathFile.getParentFile().getAbsoluteFile();
  609 + param.put("protocol.mp4_save_path", mp4SavePathFile.getAbsoluteFile());
  610 + param.put("record.appName", recordPathFile.getName());
  611 + }
  612 +
587 JSONObject responseJSON = zlmresTfulUtils.setServerConfig(mediaServerItem, param); 613 JSONObject responseJSON = zlmresTfulUtils.setServerConfig(mediaServerItem, param);
588 614
589 if (responseJSON != null && responseJSON.getInteger("code") == 0) { 615 if (responseJSON != null && responseJSON.getInteger("code") == 0) {
src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java
@@ -45,7 +45,6 @@ public class DateUtil { @@ -45,7 +45,6 @@ public class DateUtil {
45 45
46 public static String ISO8601Toyyyy_MM_dd_HH_mm_ss(String formatTime) { 46 public static String ISO8601Toyyyy_MM_dd_HH_mm_ss(String formatTime) {
47 return formatter.format(formatterCompatibleISO8601.parse(formatTime)); 47 return formatter.format(formatterCompatibleISO8601.parse(formatTime));
48 -  
49 } 48 }
50 49
51 /** 50 /**
web_src/src/components/CloudRecordDetail.vue
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 <i class="el-icon-video-camera" ></i> 18 <i class="el-icon-video-camera" ></i>
19 {{ item.substring(0,17)}} 19 {{ item.substring(0,17)}}
20 </el-tag> 20 </el-tag>
21 - <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" :href="`${basePath}/download.html?url=record/${recordFile.app}/${recordFile.stream}/${chooseDate}/${item}`" target="_blank" /> 21 + <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" :href="`${getFileBasePath()}/download.html?url=download/${recordFile.app}/${recordFile.stream}/${chooseDate}/${item}`" target="_blank" />
22 </li> 22 </li>
23 </ul> 23 </ul>
24 </div> 24 </div>
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 <li class="task-list-item" v-for="(item, index) in taskListEnded" :key="index"> 76 <li class="task-list-item" v-for="(item, index) in taskListEnded" :key="index">
77 <div class="task-list-item-box" style="height: 2rem;line-height: 2rem;"> 77 <div class="task-list-item-box" style="height: 2rem;line-height: 2rem;">
78 <span>{{ item.startTime.substr(10) }}-{{item.endTime.substr(10)}}</span> 78 <span>{{ item.startTime.substr(10) }}-{{item.endTime.substr(10)}}</span>
79 - <a class="el-icon-download download-btn" :href="mediaServerPath + '/download.html?url=../' + item.recordFile" target="_blank"> 79 + <a class="el-icon-download download-btn" :href="getFileBasePath() + '/download.html?url=download/' + item.recordFile" target="_blank">
80 </a> 80 </a>
81 </div> 81 </div>
82 </li> 82 </li>
@@ -107,15 +107,15 @@ @@ -107,15 +107,15 @@
107 import uiHeader from '../layout/UiHeader.vue' 107 import uiHeader from '../layout/UiHeader.vue'
108 import player from './dialog/easyPlayer.vue' 108 import player from './dialog/easyPlayer.vue'
109 import moment from 'moment' 109 import moment from 'moment'
  110 + import axios from "axios";
110 export default { 111 export default {
111 name: 'app', 112 name: 'app',
112 components: { 113 components: {
113 uiHeader, player 114 uiHeader, player
114 }, 115 },
115 - props: ['recordFile', 'mediaServerId', 'dateFiles', 'mediaServerPath'], 116 + props: ['recordFile', 'mediaServerId', 'dateFiles'],
116 data() { 117 data() {
117 return { 118 return {
118 - basePath: `${this.mediaServerPath}`,  
119 dateFilesObj: [], 119 dateFilesObj: [],
120 detailFiles: [], 120 detailFiles: [],
121 chooseDate: null, 121 chooseDate: null,
@@ -267,13 +267,23 @@ @@ -267,13 +267,23 @@
267 if (file == null) { 267 if (file == null) {
268 this.videoUrl = ""; 268 this.videoUrl = "";
269 }else { 269 }else {
270 - // TODO 控制列表滚动条  
271 - this.videoUrl = `${this.basePath}/record/${this.recordFile.app}/${this.recordFile.stream}/${this.chooseDate}/${this.choosedFile}` 270 + this.videoUrl = `${this.getFileBasePath()}/download/${this.recordFile.app}/${this.recordFile.stream}/${this.chooseDate}/${this.choosedFile}`
  271 +
272 console.log(this.videoUrl) 272 console.log(this.videoUrl)
273 } 273 }
274 274
275 }, 275 },
276 276
  277 + getFileBasePath(){
  278 + let basePath = ""
  279 + if (axios.defaults.baseURL.startsWith("http")) {
  280 + basePath = `${axios.defaults.baseURL}/record_proxy/${this.mediaServerId}`
  281 + }else {
  282 + basePath = `${window.location.origin}${axios.defaults.baseURL}/record_proxy/${this.mediaServerId}`
  283 + }
  284 + return basePath;
  285 + },
  286 +
277 getDataWidth(item){ 287 getDataWidth(item){
278 let timeForFile = this.getTimeForFile(item); 288 let timeForFile = this.getTimeForFile(item);
279 let result = (timeForFile[2])/((this.sliderMax - this.sliderMIn)*1000) 289 let result = (timeForFile[2])/((this.sliderMax - this.sliderMIn)*1000)