From a2d93fce811acc83ad5ff0b4a93403db22795a10 Mon Sep 17 00:00:00 2001
From: winfed <chinesezwf@gmail.com>
Date: 星期五, 09 六月 2023 15:19:18 +0800
Subject: [PATCH] fix:修复拉流代理配置展示问题:音频、录制、无人观看
---
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
index e95622c..200a7d9 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
@@ -26,6 +26,7 @@
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
+import com.genersoft.iot.vmp.vmanager.bean.SnapPath;
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import io.swagger.v3.oas.annotations.Operation;
@@ -40,6 +41,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.sip.InvalidArgumentException;
import javax.sip.SipException;
+import java.io.File;
import java.text.ParseException;
import java.util.List;
import java.util.UUID;
@@ -342,7 +344,7 @@
@Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true)
@Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true)
@GetMapping("/snap")
- public DeferredResult<String> getSnap(String deviceId, String channelId) {
+ public DeferredResult<String> getSnap(HttpServletRequest request, String deviceId, String channelId) {
if (logger.isDebugEnabled()) {
logger.debug("鑾峰彇鎴浘: {}/{}", deviceId, channelId);
}
@@ -355,11 +357,16 @@
RequestMessage message = new RequestMessage();
message.setKey(key);
message.setId(uuid);
+ String nowForUrl = DateUtil.getNowForUrl();
+ String fileName = deviceId + "_" + channelId + "_" + nowForUrl + ".jpg";
- String fileName = deviceId + "_" + channelId + "_" + DateUtil.getNowForUrl() + ".jpg";
playService.getSnap(deviceId, channelId, fileName, (code, msg, data) -> {
if (code == InviteErrorCode.SUCCESS.getCode()) {
- message.setData(data);
+ File snapFile = new File((String)data);
+ String fileNameForUrl = deviceId + "/" + channelId + "?mark=" + nowForUrl;
+ String uri = request.getRequestURL().toString().replace(request.getRequestURI(), "/api/device/query/snap/" + fileNameForUrl);
+ SnapPath snapPath = SnapPath.getInstance((String) data, snapFile.getAbsolutePath(), uri);
+ message.setData(snapPath);
}else {
message.setData(WVPResult.fail(code, msg));
}
--
Gitblit v1.8.0