| | |
| | | |
| | | import com.genersoft.iot.vmp.conf.MediaConfig; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.IMediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | |
| | | @RestController |
| | |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | | @Autowired |
| | | private IMediaServerService mediaServerService; |
| | | |
| | | @Autowired |
| | | private MediaConfig mediaConfig; |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/**/**/**", produces = "application/json;charset=UTF-8") |
| | | public Object proxy(HttpServletRequest request, HttpServletResponse response){ |
| | | public Object proxy(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException{ |
| | | |
| | | |
| | | String baseRequestURI = request.getRequestURI(); |
| | |
| | | return null; |
| | | } |
| | | // 后续改为根据Id获取对应的ZLM |
| | | ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); |
| | | IMediaServerItem mediaInfo = mediaServerService.getOne(mediaId); |
| | | if (mediaInfo == null) { |
| | | response.setStatus(HttpStatus.NOT_FOUND.value()); |
| | | return null; |
| | | } |
| | | String requestURI = String.format("http://%s:%s%s?%s", |
| | | mediaInfo.getSdpIp(), |
| | | mediaConfig.getRecordAssistPort(), |
| | | baseRequestURI.substring(baseRequestURI.indexOf(mediaId) + mediaId.length()), |
| | | URLDecoder.decode(request.getQueryString()) |
| | | URLDecoder.decode(request.getQueryString(), "UTF-8") |
| | | ); |
| | | // 发送请求 |
| | | RestTemplate restTemplate = new RestTemplate(); |