From 3e5da98539f7508e12429a58bda3d240f4ff0cea Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 4 Apr 2024 07:19:46 +0800 Subject: [PATCH] =?UTF-8?q?1078-=E6=94=AF=E6=8C=81=E7=82=B9=E6=92=AD?= =?UTF-8?q?=E6=9A=82=E5=81=9C/=E7=BB=A7=E7=BB=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/jt1078/config/JT1078Controller.java | 26 +++++++++++++ .../vmp/jt1078/service/Ijt1078Service.java | 4 ++ .../service/impl/jt1078ServiceImpl.java | 37 +++++++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/config/JT1078Controller.java b/src/main/java/com/genersoft/iot/vmp/jt1078/config/JT1078Controller.java index 4d9010149..3d0940797 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/config/JT1078Controller.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/config/JT1078Controller.java @@ -120,6 +120,32 @@ public class JT1078Controller { service.stopPlay(deviceId, channelId); } + @Operation(summary = "1078-暂停点播", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "deviceId", description = "设备国标编号", required = true) + @Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true) + @GetMapping("/live/pause") + public void pauseLive(HttpServletRequest request, + @Parameter(required = true) String deviceId, + @Parameter(required = false) String channelId) { + if (ObjectUtils.isEmpty(channelId)) { + channelId = "1"; + } + service.pausePlay(deviceId, channelId); + } + + @Operation(summary = "1078-继续点播", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "deviceId", description = "设备国标编号", required = true) + @Parameter(name = "channelId", description = "通道国标编号, 一般为从1开始的数字", required = true) + @GetMapping("/live/continue") + public void continueLive(HttpServletRequest request, + @Parameter(required = true) String deviceId, + @Parameter(required = false) String channelId) { + if (ObjectUtils.isEmpty(channelId)) { + channelId = "1"; + } + service.continueLivePlay(deviceId, channelId); + } + @Operation(summary = "分页查询部标设备", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "page", description = "当前页", required = true) @Parameter(name = "count", description = "每页查询数量", required = true) diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/service/Ijt1078Service.java b/src/main/java/com/genersoft/iot/vmp/jt1078/service/Ijt1078Service.java index 7406099df..bd9486e6b 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/service/Ijt1078Service.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/service/Ijt1078Service.java @@ -24,4 +24,8 @@ public interface Ijt1078Service { void play(String deviceId, String channelId, GeneralCallback callback); void stopPlay(String deviceId, String channelId); + + void pausePlay(String deviceId, String channelId); + + void continueLivePlay(String deviceId, String channelId); } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/jt1078ServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/jt1078ServiceImpl.java index af87e01b7..e295d6c1f 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/jt1078ServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/jt1078ServiceImpl.java @@ -205,6 +205,7 @@ public class jt1078ServiceImpl implements Ijt1078Service { j9102.setCloseType(0); j9102.setStreamType(1); jt1078Template.stopLive(deviceId, j9102, 6); + logger.info("[1078-停止点播] deviceId: {}, channelId: {}", deviceId, channelId); // 删除缓存数据 if (streamInfo != null) { // 关闭rtpServer @@ -218,4 +219,40 @@ public class jt1078ServiceImpl implements Ijt1078Service { } } } + + @Override + public void pausePlay(String deviceId, String channelId) { + String playKey = VideoManagerConstants.INVITE_INFO_1078 + deviceId + ":" + channelId; + dynamicTask.stop(playKey); + StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey); + if (streamInfo == null) { + logger.info("[1078-暂停点播] 未找到点播信息 deviceId: {}, channelId: {}", deviceId, channelId); + } + logger.info("[1078-暂停点播] deviceId: {}, channelId: {}", deviceId, channelId); + // 发送暂停命令 + J9102 j9102 = new J9102(); + j9102.setChannel(Integer.valueOf(channelId)); + j9102.setCommand(2); + j9102.setCloseType(0); + j9102.setStreamType(1); + jt1078Template.stopLive(deviceId, j9102, 6); + } + + @Override + public void continueLivePlay(String deviceId, String channelId) { + String playKey = VideoManagerConstants.INVITE_INFO_1078 + deviceId + ":" + channelId; + dynamicTask.stop(playKey); + StreamInfo streamInfo = (StreamInfo) redisTemplate.opsForValue().get(playKey); + if (streamInfo == null) { + logger.info("[1078-继续点播] 未找到点播信息 deviceId: {}, channelId: {}", deviceId, channelId); + } + logger.info("[1078-继续点播] deviceId: {}, channelId: {}", deviceId, channelId); + // 发送暂停命令 + J9102 j9102 = new J9102(); + j9102.setChannel(Integer.valueOf(channelId)); + j9102.setCommand(2); + j9102.setCloseType(0); + j9102.setStreamType(1); + jt1078Template.stopLive(deviceId, j9102, 6); + } }