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 | 1 | package com.genersoft.iot.vmp.media.zlm; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | +import com.genersoft.iot.vmp.conf.MediaServerConfig; | |
| 4 | 5 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 5 | 6 | import org.slf4j.Logger; |
| 6 | 7 | import org.slf4j.LoggerFactory; |
| 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | +import org.springframework.beans.factory.annotation.Value; | |
| 8 | 10 | import org.springframework.http.HttpHeaders; |
| 9 | 11 | import org.springframework.http.HttpRequest; |
| 10 | 12 | import org.springframework.http.HttpStatus; |
| ... | ... | @@ -27,6 +29,8 @@ public class ZLMHTTPProxyController { |
| 27 | 29 | @Autowired |
| 28 | 30 | private IVideoManagerStorager storager; |
| 29 | 31 | |
| 32 | + @Value("${media.port}") | |
| 33 | + private int mediaHttpPort; | |
| 30 | 34 | |
| 31 | 35 | @ResponseBody |
| 32 | 36 | @RequestMapping(value = "/**/**/**", produces = "application/json;charset=UTF-8") |
| ... | ... | @@ -35,11 +39,12 @@ public class ZLMHTTPProxyController { |
| 35 | 39 | if (storager.getMediaInfo() == null) { |
| 36 | 40 | return "未接入流媒体"; |
| 37 | 41 | } |
| 42 | + MediaServerConfig mediaInfo = storager.getMediaInfo(); | |
| 38 | 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 | 46 | request.getRequestURI().replace("/zlm",""), |
| 42 | - storager.getMediaInfo().getHookAdminParams(), | |
| 47 | + mediaInfo.getHookAdminParams(), | |
| 43 | 48 | request.getQueryString() |
| 44 | 49 | ); |
| 45 | 50 | // 发送请求 | ... | ... |