From 937e59143004b11a808eb93eb894ffe53871a19a Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期四, 15 四月 2021 17:48:52 +0800
Subject: [PATCH] 解决串流,解决编辑上级平台却新建了的问题

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 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 ade4f46..7db5714 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
@@ -220,7 +220,7 @@
 		// String app = json.getString("app");
 		// String stream = json.getString("stream");
 
-		ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
+		ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_shell_login, json);
 		if (subscribe != null) subscribe.response(json);
 
 		JSONObject ret = new JSONObject();
@@ -240,18 +240,22 @@
 		if (logger.isDebugEnabled()) {
 			logger.debug("ZLM HOOK on_stream_changed API璋冪敤锛屽弬鏁帮細" + json.toString());
 		}
+
+		ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, json);
+		if (subscribe != null) subscribe.response(json);
+
 		// 娴佹秷澶辩Щ闄edis play
 		String app = json.getString("app");
 		String streamId = json.getString("stream");
 		String schema = json.getString("schema");
 		JSONArray tracks = json.getJSONArray("tracks");
-		String regist = json.getString("regist");
+		boolean regist = json.getBoolean("regist");
 		if (tracks != null) {
 			System.out.println("222222" + schema);
 		}
 		if ("rtmp".equals(schema)){
 
-			if ("rtp".equals(app) && regist != null ) {
+			if ("rtp".equals(app) && !regist ) {
 				StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
 				if (streamInfo!=null){
 					redisCatchStorage.stopPlay(streamInfo);
@@ -262,7 +266,7 @@
 				}
 			}else {
 				if (!"rtp".equals(app) ){
-					if (regist == null) {
+					if (regist) {
 						zlmMediaListManager.addMedia(app, streamId);
 					}else {
 						zlmMediaListManager.removeMedia(app, streamId);

--
Gitblit v1.8.0