Commit ed1fe4b9388cfa9c1cf691f840afceddce8c7bfd
1 parent
bc2e5e7a
与主线同步,修复zlm在docker时代理错误
Showing
1 changed file
with
8 additions
and
3 deletions
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHTTPProxyController.java
| 1 | package com.genersoft.iot.vmp.media.zlm; | 1 | package com.genersoft.iot.vmp.media.zlm; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | +import com.genersoft.iot.vmp.conf.MediaServerConfig; | ||
| 4 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 5 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 5 | import org.slf4j.Logger; | 6 | import org.slf4j.Logger; |
| 6 | import org.slf4j.LoggerFactory; | 7 | import org.slf4j.LoggerFactory; |
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | +import org.springframework.beans.factory.annotation.Value; | ||
| 8 | import org.springframework.http.HttpHeaders; | 10 | import org.springframework.http.HttpHeaders; |
| 9 | import org.springframework.http.HttpRequest; | 11 | import org.springframework.http.HttpRequest; |
| 10 | import org.springframework.http.HttpStatus; | 12 | import org.springframework.http.HttpStatus; |
| @@ -27,6 +29,8 @@ public class ZLMHTTPProxyController { | @@ -27,6 +29,8 @@ public class ZLMHTTPProxyController { | ||
| 27 | @Autowired | 29 | @Autowired |
| 28 | private IVideoManagerStorager storager; | 30 | private IVideoManagerStorager storager; |
| 29 | 31 | ||
| 32 | + @Value("${media.port}") | ||
| 33 | + private int mediaHttpPort; | ||
| 30 | 34 | ||
| 31 | @ResponseBody | 35 | @ResponseBody |
| 32 | @RequestMapping(value = "/**/**/**", produces = "application/json;charset=UTF-8") | 36 | @RequestMapping(value = "/**/**/**", produces = "application/json;charset=UTF-8") |
| @@ -35,11 +39,12 @@ public class ZLMHTTPProxyController { | @@ -35,11 +39,12 @@ public class ZLMHTTPProxyController { | ||
| 35 | if (storager.getMediaInfo() == null) { | 39 | if (storager.getMediaInfo() == null) { |
| 36 | return "未接入流媒体"; | 40 | return "未接入流媒体"; |
| 37 | } | 41 | } |
| 42 | + MediaServerConfig mediaInfo = storager.getMediaInfo(); | ||
| 38 | String requestURI = String.format("http://%s:%s%s?%s&%s", | 43 | String requestURI = String.format("http://%s:%s%s?%s&%s", |
| 39 | - storager.getMediaInfo().getLocalIP(), | ||
| 40 | - storager.getMediaInfo().getHttpPort(), | 44 | + mediaInfo.getLocalIP(), |
| 45 | + mediaHttpPort, | ||
| 41 | request.getRequestURI().replace("/zlm",""), | 46 | request.getRequestURI().replace("/zlm",""), |
| 42 | - storager.getMediaInfo().getHookAdminParams(), | 47 | + mediaInfo.getHookAdminParams(), |
| 43 | request.getQueryString() | 48 | request.getQueryString() |
| 44 | ); | 49 | ); |
| 45 | // 发送请求 | 50 | // 发送请求 |