zhangqiankun 2 年之前
父节点
当前提交
6d115066c7

+ 11 - 0
src/main/java/com/persagy/cameractl/conf/CVRConfig.java

@@ -24,6 +24,9 @@ public class CVRConfig {
 	/** 当开启了SDK的对接方式后,回放是否采用流ID的播放方式 */
 	private boolean streamEnable = false;
 	
+	/** nginx 地址 */
+	private String nginxAddress = "http://127.0.0.1:9998/video/";
+	
 	private List<AddressConfig> addressConfig = new ArrayList<AddressConfig>();
 	
 	public boolean isSdkEnable() {
@@ -42,6 +45,14 @@ public class CVRConfig {
 		this.streamEnable = streamEnable;
 	}
 
+	public String getNginxAddress() {
+		return nginxAddress;
+	}
+
+	public void setNginxAddress(String nginxAddress) {
+		this.nginxAddress = nginxAddress;
+	}
+
 	public List<AddressConfig> getAddressConfig() {
 		return addressConfig;
 	}

+ 6 - 1
src/main/java/com/persagy/cameractl/cvr/PlayBackController.java

@@ -10,12 +10,14 @@ import java.util.Timer;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.persagy.cameractl.conf.CVRConfig;
 import com.persagy.cameractl.conf.CameraStream;
 import com.persagy.cameractl.cvr.HCNetSDK.NET_DVR_USER_LOGIN_INFO;
 import com.persagy.cameractl.cvr.HCNetSDK.NET_DVR_VOD_PARA;
@@ -41,6 +43,9 @@ import cn.hutool.core.util.StrUtil;
 public class PlayBackController {
 	public static Logger logger = LoggerFactory.getLogger(PlayBackController.class);
 
+	@Autowired
+	private CVRConfig cvrConfig;
+	
 	@RequestMapping(value = "/playback/{operType}", method = RequestMethod.POST)
 	public Object play(@RequestBody Camera camera, @PathVariable("operType") String operType) throws Exception {
 		// 验证是否需要走配置
@@ -97,7 +102,7 @@ public class PlayBackController {
 		
         if ("true".equals(result)) {
         	Map<String, String> data = new HashMap<String, String>(4);
-			data.put("videoUrl", file.getName());
+			data.put("videoUrl", cvrConfig.getNginxAddress() + file.getName());
 			return ResultTools.dataResult(data);
 		}
         

文件差异内容过多而无法显示
+ 1 - 1
src/main/resources/application.yml