diff --git a/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java b/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java index 24f2165..7ae1f38 100644 --- a/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java +++ b/inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java @@ -9,10 +9,10 @@ import com.inspect.ivs.enums.RtspType; import com.inspect.ivs.service.IvsCommonService; import com.inspect.ivs.service.XinTongComponent; import com.inspect.ivs.service.ZlMediaComponent; -import com.inspect.ivs.view.IvsVideoRtspView; import com.inspect.ivs.view.IvsStreamStartView; -import com.inspect.ivs.vo.IvsVideoRtspVo; +import com.inspect.ivs.view.IvsVideoRtspView; import com.inspect.ivs.vo.IvsStreamStartVo; +import com.inspect.ivs.vo.IvsVideoRtspVo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -27,17 +27,13 @@ import javax.annotation.Resource; @RequestMapping({"/api/v1/stream"}) public class IvsStreamController { private static final Logger log = LoggerFactory.getLogger(IvsStreamController.class); - + private final IvsCommonService ivsCommonService; + private final ZlMediaComponent zlMediaComponent; + private final XinTongComponent xinTongComponent; @Value("${ivs.test:false}") private Boolean bIvsTestMode; - @Value("${rtsp.type:xintong}") private RtspType rtspType; - - private final IvsCommonService ivsCommonService; - private final ZlMediaComponent zlMediaComponent; - private final XinTongComponent xinTongComponent; - @Resource private RedisService redisService; @@ -61,12 +57,19 @@ public class IvsStreamController { ivsVideoRtspView = new IvsVideoRtspView(); ivsVideoRtspView.setRtspURL("rtsp://admin:htjc2018@192.168.1.134:554/cam/realmonitor?channel=3&subtype=0"); } else { - String label = java.util.UUID.randomUUID().toString().trim().replaceAll(StringUtils.DASH, StringUtils.EMPTY); - ivsVideoRtspView = ivsCommonService.postJson( - label, - ivsVideoRtspVo, - IvsConst.URI_VIDEO_RTSP, - IvsVideoRtspView.class); + String rtspUrl = (String) this.redisService.redisTemplate.opsForValue().get("sys_config:rtsp_" + ivsStreamStartVo.getSerial()); + if (StringUtils.isNotEmpty(rtspUrl)) { + log.info("IVS_STREAM_START SYS_CONFIG_RTSP: {}", rtspUrl); + ivsVideoRtspView = new IvsVideoRtspView(); + ivsVideoRtspView.setRtspURL(rtspUrl); + } else { + String label = java.util.UUID.randomUUID().toString().trim().replaceAll(StringUtils.DASH, StringUtils.EMPTY); + ivsVideoRtspView = ivsCommonService.postJson( + label, + ivsVideoRtspVo, + IvsConst.URI_VIDEO_RTSP, + IvsVideoRtspView.class); + } } log.debug("[IVS] {}", ivsVideoRtspView);