From 13be0e74521e4d258ce9540783a9b5e24c110e24 Mon Sep 17 00:00:00 2001 From: guoshengxiong <1923636941@qq.com> Date: Thu, 25 Apr 2024 22:01:10 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xmgl/modules/video/controller/VideoItemController.java | 2 ++ src/main/java/com/zhgd/xmgl/util/HikVideoUtil.java | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/zhgd/xmgl/modules/video/controller/VideoItemController.java b/src/main/java/com/zhgd/xmgl/modules/video/controller/VideoItemController.java index 93086b557..9a41b2259 100644 --- a/src/main/java/com/zhgd/xmgl/modules/video/controller/VideoItemController.java +++ b/src/main/java/com/zhgd/xmgl/modules/video/controller/VideoItemController.java @@ -150,6 +150,8 @@ public class VideoItemController { @ApiOperation(value = "根据itemId视频Id查询视频播放url", notes = "根据itemId视频Id查询视频播放url", httpMethod = "POST") @ApiImplicitParams({ @ApiImplicitParam(name = "itemId", value = "视频记录ID", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "streamType", value = "2主码流,不传子码流", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "type", value = "取流协议 rtsp、rtmp、hls,不传默认hls", paramType = "body", required = false, dataType = "String"), }) @PostMapping("/getVideoItemInfo") public Result> getVideoItemInfo(@RequestBody Map map) { diff --git a/src/main/java/com/zhgd/xmgl/util/HikVideoUtil.java b/src/main/java/com/zhgd/xmgl/util/HikVideoUtil.java index 19c684f80..2f88616e8 100644 --- a/src/main/java/com/zhgd/xmgl/util/HikVideoUtil.java +++ b/src/main/java/com/zhgd/xmgl/util/HikVideoUtil.java @@ -51,8 +51,11 @@ public class HikVideoUtil { } paramMap.put("streamType", streamType); paramMap.put("protocol", StringUtils.isNotEmpty(type) ? type : "hls"); - paramMap.put("expand", "streamform=rtp"); + paramMap.put("expand", "transcode=0"); + paramMap.put("transmode", 1); + paramMap.put("streamform", "rtp"); String body = JSON.toJSON(paramMap).toString(); + log.info("callPostApiGetPreviewURL body:{}", body); Map path = new HashMap(2) { { put("https://", getCamsApi); @@ -60,7 +63,7 @@ public class HikVideoUtil { }; String host = Ip + ":" + port; String result = doPostStringArtemis(host, path, body, null, null, "application/json", appke, appSecret); - log.info(result); + log.info("callPostApiGetPreviewURL result:{}", result); if (result != null && result.length() > 0) { JSONObject json = JSONObject.parseObject(result); if ("0".equals((String) json.get("code"))) {