1078-支持点播暂停/继续

This commit is contained in:
648540858
2024-04-04 07:19:46 +08:00
parent a7b7371e74
commit 3e5da98539
3 changed files with 67 additions and 0 deletions

View File

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

View File

@@ -24,4 +24,8 @@ public interface Ijt1078Service {
void play(String deviceId, String channelId, GeneralCallback<StreamInfo> callback);
void stopPlay(String deviceId, String channelId);
void pausePlay(String deviceId, String channelId);
void continueLivePlay(String deviceId, String channelId);
}

View File

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