From ad93be12fb3705e995cf0dab933760edaef3dd7a Mon Sep 17 00:00:00 2001 From: 64850858 <648540858@qq.com> Date: 星期二, 01 六月 2021 17:05:07 +0800 Subject: [PATCH] 添加云端录像功能 --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHTTPProxyController.java | 108 +++++++++++++++++++++++++++--------------------------- 1 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHTTPProxyController.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHTTPProxyController.java index 05d10b5..a00bc2a 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHTTPProxyController.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHTTPProxyController.java @@ -1,54 +1,54 @@ -package com.genersoft.iot.vmp.media.zlm; - -import com.genersoft.iot.vmp.conf.MediaConfig; -import com.genersoft.iot.vmp.storager.IRedisCatchStorage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -@RestController -@RequestMapping("/zlm") -public class ZLMHTTPProxyController { - - - // private final static Logger logger = LoggerFactory.getLogger(ZLMHTTPProxyController.class); - - @Autowired - private IRedisCatchStorage redisCatchStorage; - - @Autowired - private MediaConfig mediaConfig; - - @ResponseBody - @RequestMapping(value = "/**/**/**", produces = "application/json;charset=UTF-8") - public Object proxy(HttpServletRequest request, HttpServletResponse response){ - - if (redisCatchStorage.getMediaInfo() == null) { - return "鏈帴鍏ユ祦濯掍綋"; - } - ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); - String requestURI = String.format("http://%s:%s%s?%s&%s", - mediaInfo.getLocalIP(), - mediaConfig.getHttpPort(), - request.getRequestURI().replace("/zlm",""), - mediaInfo.getHookAdminParams(), - request.getQueryString() - ); - // 鍙戦�佽姹� - RestTemplate restTemplate = new RestTemplate(); - //灏嗘寚瀹氱殑url杩斿洖鐨勫弬鏁拌嚜鍔ㄥ皝瑁呭埌鑷畾涔夊ソ鐨勫搴旂被瀵硅薄涓� - Object result = null; - try { - result = restTemplate.getForObject(requestURI,Object.class); - - }catch (HttpClientErrorException httpClientErrorException) { - response.setStatus(httpClientErrorException.getStatusCode().value()); - } - return result; - } -} +//package com.genersoft.iot.vmp.media.zlm; +// +//import com.genersoft.iot.vmp.conf.MediaConfig; +//import com.genersoft.iot.vmp.storager.IRedisCatchStorage; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.web.bind.annotation.*; +//import org.springframework.web.client.HttpClientErrorException; +//import org.springframework.web.client.RestTemplate; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +// +//@RestController +//@RequestMapping("/zlm") +//public class ZLMHTTPProxyController { +// +// +// // private final static Logger logger = LoggerFactory.getLogger(ZLMHTTPProxyController.class); +// +// @Autowired +// private IRedisCatchStorage redisCatchStorage; +// +// @Autowired +// private MediaConfig mediaConfig; +// +// @ResponseBody +// @RequestMapping(value = "/**/**/**", produces = "application/json;charset=UTF-8") +// public Object proxy(HttpServletRequest request, HttpServletResponse response){ +// +// if (redisCatchStorage.getMediaInfo() == null) { +// return "鏈帴鍏ユ祦濯掍綋"; +// } +// ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); +// String requestURI = String.format("http://%s:%s%s?%s&%s", +// mediaInfo.getLocalIP(), +// mediaConfig.getHttpPort(), +// request.getRequestURI().replace("/zlm",""), +// mediaInfo.getHookAdminParams(), +// request.getQueryString() +// ); +// // 鍙戦�佽姹� +// RestTemplate restTemplate = new RestTemplate(); +// //灏嗘寚瀹氱殑url杩斿洖鐨勫弬鏁拌嚜鍔ㄥ皝瑁呭埌鑷畾涔夊ソ鐨勫搴旂被瀵硅薄涓� +// Object result = null; +// try { +// result = restTemplate.getForObject(requestURI,Object.class); +// +// }catch (HttpClientErrorException httpClientErrorException) { +// response.setStatus(httpClientErrorException.getStatusCode().value()); +// } +// return result; +// } +//} -- Gitblit v1.8.0