From b92027f31ef24583e8b9d4c2dc44c7e9262a2023 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期一, 26 四月 2021 10:48:51 +0800
Subject: [PATCH] 修复注册是数据传输模式被回复默认

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
index 1bf5162..5583832 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
@@ -1,12 +1,9 @@
 package com.genersoft.iot.vmp.media.zlm;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.TypeReference;
 import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
 import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
-import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
 import com.genersoft.iot.vmp.service.IStreamPushService;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
@@ -42,6 +39,9 @@
     @Autowired
     private IStreamPushService streamPushService;
 
+    @Autowired
+    private ZLMHttpHookSubscribe subscribe;
+
 
     public void updateMediaList() {
         storager.clearMediaList();
@@ -66,6 +66,15 @@
 
             if (streamPushItems != null) {
                 storager.updateMediaList(streamPushItems);
+                for (StreamPushItem streamPushItem : streamPushItems) {
+                    JSONObject jsonObject = new JSONObject();
+                    jsonObject.put("app", streamPushItem.getApp());
+                    jsonObject.put("stream", streamPushItem.getStream());
+                    subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_play,jsonObject,(response)->{
+                        System.out.println(1222211111);
+                        updateMedia(response.getString("app"), response.getString("stream"));
+                    });
+                }
             }
         }));
 
@@ -73,6 +82,12 @@
 
     public void addMedia(String app, String streamId) {
         //浣跨敤寮傛鏇存柊鎺ㄦ祦
+        updateMedia(app, streamId);
+    }
+
+
+    public void updateMedia(String app, String streamId) {
+        //浣跨敤寮傛鏇存柊鎺ㄦ祦
         zlmresTfulUtils.getMediaList(app, streamId, "rtmp", json->{
 
             if (json == null) return;

--
Gitblit v1.8.0