Browse Source

feat: 新增设备视频流从sys_config表获取,要求数据key值为rtsp_XXX,value值为实际视频流

master
yinhuaiwei 1 week ago
parent
commit
ed0269a930
1 changed files with 18 additions and 15 deletions
  1. +18
    -15
      inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java

+ 18
- 15
inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java View File

@ -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);


Loading…
Cancel
Save