diff --git a/src/main/java/com/genersoft/iot/vmp/media/event/media/MediaArrivalEvent.java b/src/main/java/com/genersoft/iot/vmp/media/event/media/MediaArrivalEvent.java index 2f51a3e2..8273bf9d 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/event/media/MediaArrivalEvent.java +++ b/src/main/java/com/genersoft/iot/vmp/media/event/media/MediaArrivalEvent.java @@ -5,6 +5,8 @@ import com.genersoft.iot.vmp.media.bean.MediaServer; import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; import com.genersoft.iot.vmp.vmanager.bean.StreamContent; +import java.util.Map; + /** * 流到来事件 */ @@ -22,6 +24,7 @@ public class MediaArrivalEvent extends MediaEvent { mediaArrivalEvent.setSchema(hookParam.getSchema()); mediaArrivalEvent.setSchema(hookParam.getSchema()); mediaArrivalEvent.setHookParam(hookParam); + mediaArrivalEvent.setParamMap(hookParam.getParamMap()); return mediaArrivalEvent; } @@ -33,6 +36,8 @@ public class MediaArrivalEvent extends MediaEvent { private StreamContent streamInfo; + private Map paramMap; + public MediaInfo getMediaInfo() { return mediaInfo; } @@ -65,4 +70,13 @@ public class MediaArrivalEvent extends MediaEvent { public void setStreamInfo(StreamContent streamInfo) { this.streamInfo = streamInfo; } + + + public Map getParamMap() { + return paramMap; + } + + public void setParamMap(Map paramMap) { + this.paramMap = paramMap; + } } 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 636b4bf1..5698238e 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.util.ObjectUtils; 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; /** @@ -218,6 +221,18 @@ public class ZLMHttpHookListener { 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 {