From 48ca11aaf324d017c08fadabf27c753fdd76c9b7 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期四, 10 十月 2024 20:19:36 +0800 Subject: [PATCH] xxx --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 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 738d3f8..5698238 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -36,6 +36,9 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.HashMap; import java.util.Map; /** @@ -190,7 +193,15 @@ } } - + /** + * rtsp/rtmp娴佹敞鍐屾垨娉ㄩ攢鏃惰Е鍙戞浜嬩欢锛涙浜嬩欢瀵瑰洖澶嶄笉鏁忔劅銆� + */ +// @ResponseBody +// @PostMapping(value = "/on_stream_changed", produces = "application/json;charset=UTF-8") +// public HookResult onStreamChanged(@RequestBody JSONObject param) { +// System.out.println(11); +// return HookResult.SUCCESS(); +// } /** * rtsp/rtmp娴佹敞鍐屾垨娉ㄩ攢鏃惰Е鍙戞浜嬩欢锛涙浜嬩欢瀵瑰洖澶嶄笉鏁忔劅銆� */ @@ -210,6 +221,18 @@ if (param.getSchema().equalsIgnoreCase("rtsp")) { if (param.isRegist()) { logger.info("[ZLM HOOK] 娴佹敞鍐�, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream()); + String queryParams = param.getParams(); + if (queryParams == null) { + try { + URL url = new URL("http" + param.getOriginUrl().substring(4)); + queryParams = url.getQuery(); + }catch (MalformedURLException ignored) {} + } + if (queryParams != null) { + param.setParamMap(MediaServerUtils.urlParamToMap(queryParams)); + }else { + param.setParamMap(new HashMap<>()); + } MediaArrivalEvent mediaArrivalEvent = MediaArrivalEvent.getInstance(this, param, mediaServer); applicationEventPublisher.publishEvent(mediaArrivalEvent); } else { -- Gitblit v1.8.0