From e48ef997c03b49c8090970f5fbb29ce80b0ac6df Mon Sep 17 00:00:00 2001
From: 64850858 <648540858@qq.com>
Date: 星期三, 14 七月 2021 15:57:39 +0800
Subject: [PATCH] 更换播放器, 修正和优化sql脚本,

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
index 7fa0a47..bd8485d 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -7,6 +7,7 @@
 import com.alibaba.fastjson.JSONArray;
 import com.genersoft.iot.vmp.common.StreamInfo;
 import com.genersoft.iot.vmp.conf.MediaConfig;
+import com.genersoft.iot.vmp.conf.UserSetup;
 import com.genersoft.iot.vmp.gb28181.bean.Device;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
@@ -14,10 +15,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
-import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -54,6 +53,9 @@
 	private IRedisCatchStorage redisCatchStorage;
 
 	@Autowired
+	private ZLMRESTfulUtils zlmresTfulUtils;
+
+	@Autowired
 	private ZLMServerManger zlmServerManger;
 
 	 @Autowired
@@ -62,8 +64,8 @@
 	@Autowired
 	private ZLMHttpHookSubscribe subscribe;
 
-	@Value("${userSettings.autoApplyPlay}")
-	private boolean autoApplyPlay;
+	@Autowired
+	private UserSetup userSetup;
 
 	@Autowired
 	private MediaConfig mediaConfig;
@@ -132,10 +134,8 @@
 	@ResponseBody
 	@PostMapping(value = "/on_publish", produces = "application/json;charset=UTF-8")
 	public ResponseEntity<String> onPublish(@RequestBody JSONObject json){
-		
-		if (logger.isDebugEnabled()) {
-			logger.debug("ZLM HOOK on_publish API璋冪敤锛屽弬鏁帮細" + json.toString());
-		}
+
+		logger.debug("ZLM HOOK on_publish API璋冪敤锛屽弬鏁帮細" + json.toString());
 
 		ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
 		if (subscribe != null) subscribe.response(json);
@@ -144,7 +144,7 @@
 		ret.put("code", 0);
 		ret.put("msg", "success");
 		ret.put("enableHls", true);
-		ret.put("enableMP4", false);
+		ret.put("enableMP4", userSetup.isRecordPushLive());
 		ret.put("enableRtxp", true);
 		return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
 	}
@@ -333,11 +333,10 @@
 		if (logger.isDebugEnabled()) {
 			logger.debug("ZLM HOOK on_stream_not_found API璋冪敤锛屽弬鏁帮細" + json.toString());
 		}
-		if (autoApplyPlay) {
+		if (userSetup.isAutoApplyPlay()) {
 			String app = json.getString("app");
 			String streamId = json.getString("stream");
-				StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
-			if ("rtp".equals(app) && streamId.contains("gb_play") && streamInfo == null) {
+			if ("rtp".equals(app) && streamId.contains("gb_play") ) {
 				String[] s = streamId.split("_");
 				if (s.length == 4) {
 					String deviceId = s[2];
@@ -352,7 +351,6 @@
 					}
 
 				}
-
 			}
 
 		}

--
Gitblit v1.8.0