From 6e67b1902e783b4a13a7d8e83fd894dda2e4f61e Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: 星期一, 19 四月 2021 14:24:08 +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