From 5a152791c0677bd47d4386a1ba54ccf9060849ce Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 29 May 2023 23:28:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96=E6=88=AA?= =?UTF-8?q?=E5=9B=BE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../callback/DeferredResultHolder.java | 2 + .../request/impl/InviteRequestProcessor.java | 6 +- .../iot/vmp/media/zlm/ZLMRESTfulUtils.java | 1 - .../iot/vmp/service/IInviteStreamService.java | 4 +- .../iot/vmp/service/IPlayService.java | 16 +++-- ...eErrorCallback.java => ErrorCallback.java} | 2 +- .../iot/vmp/service/bean/InviteErrorCode.java | 1 + .../service/impl/InviteStreamServiceImpl.java | 12 ++-- .../iot/vmp/service/impl/PlayServiceImpl.java | 64 +++++++++++++++++-- .../com/genersoft/iot/vmp/utils/DateUtil.java | 15 +++++ .../vmanager/gb28181/play/PlayController.java | 31 +++++++++ 11 files changed, 127 insertions(+), 27 deletions(-) rename src/main/java/com/genersoft/iot/vmp/service/bean/{InviteErrorCallback.java => ErrorCallback.java} (68%) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/DeferredResultHolder.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/DeferredResultHolder.java index a351445e..83722a09 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/DeferredResultHolder.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/DeferredResultHolder.java @@ -51,6 +51,8 @@ public class DeferredResultHolder { public static final String CALLBACK_CMD_BROADCAST = "CALLBACK_BROADCAST"; + public static final String CALLBACK_CMD_SNAP= "CALLBACK_SNAP"; + private Map> map = new ConcurrentHashMap<>(); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java index f2e0698c..07a1538e 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java @@ -19,7 +19,7 @@ import com.genersoft.iot.vmp.service.IMediaServerService; import com.genersoft.iot.vmp.service.IPlayService; import com.genersoft.iot.vmp.service.IStreamProxyService; import com.genersoft.iot.vmp.service.IStreamPushService; -import com.genersoft.iot.vmp.service.bean.InviteErrorCallback; +import com.genersoft.iot.vmp.service.bean.ErrorCallback; import com.genersoft.iot.vmp.service.bean.InviteErrorCode; import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; import com.genersoft.iot.vmp.service.bean.SSRCInfo; @@ -377,7 +377,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements Long finalStartTime = startTime; Long finalStopTime = stopTime; - InviteErrorCallback hookEvent = (code, msg, data) -> { + ErrorCallback hookEvent = (code, msg, data) -> { StreamInfo streamInfo = (StreamInfo)data; MediaServerItem mediaServerItemInUSe = mediaServerService.getOne(streamInfo.getMediaServerId()); logger.info("[上级Invite]下级已经开始推流。 回复200OK(SDP), {}/{}", streamInfo.getApp(), streamInfo.getStream()); @@ -426,7 +426,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements logger.error("[命令发送失败] 国标级联 回复SdpAck", e); } }; - InviteErrorCallback errorEvent = ((statusCode, msg, data) -> { + ErrorCallback errorEvent = ((statusCode, msg, data) -> { // 未知错误。直接转发设备点播的错误 try { if (statusCode > 0) { diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java index a2fd1e37..2378d529 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java @@ -154,7 +154,6 @@ public class ZLMRESTfulUtils { public void sendGetForImg(MediaServerItem mediaServerItem, String api, Map params, String targetPath, String fileName) { String url = String.format("http://%s:%s/index/api/%s", mediaServerItem.getIp(), mediaServerItem.getHttpPort(), api); - logger.debug(url); HttpUrl parseUrl = HttpUrl.parse(url); if (parseUrl == null) { return; diff --git a/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java b/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java index ca90095d..fd388393 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.service; import com.genersoft.iot.vmp.common.InviteInfo; import com.genersoft.iot.vmp.common.InviteSessionType; -import com.genersoft.iot.vmp.service.bean.InviteErrorCallback; +import com.genersoft.iot.vmp.service.bean.ErrorCallback; /** * 记录国标点播的状态,包括实时预览,下载,录像回放 @@ -54,7 +54,7 @@ public interface IInviteStreamService { /** * 添加一个invite回调 */ - void once(InviteSessionType type, String deviceId, String channelId, String stream, InviteErrorCallback callback); + void once(InviteSessionType type, String deviceId, String channelId, String stream, ErrorCallback callback); /** * 调用一个invite回调 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IPlayService.java b/src/main/java/com/genersoft/iot/vmp/service/IPlayService.java index f6e41c68..51624112 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/IPlayService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IPlayService.java @@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.conf.exception.ServiceException; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; -import com.genersoft.iot.vmp.service.bean.InviteErrorCallback; +import com.genersoft.iot.vmp.service.bean.ErrorCallback; import com.genersoft.iot.vmp.service.bean.SSRCInfo; import javax.sip.InvalidArgumentException; @@ -17,8 +17,8 @@ import java.text.ParseException; public interface IPlayService { void play(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, - InviteErrorCallback callback); - SSRCInfo play(MediaServerItem mediaServerItem, String deviceId, String channelId, InviteErrorCallback callback); + ErrorCallback callback); + SSRCInfo play(MediaServerItem mediaServerItem, String deviceId, String channelId, ErrorCallback callback); MediaServerItem getNewMediaServerItem(Device device); @@ -27,13 +27,13 @@ public interface IPlayService { */ MediaServerItem getNewMediaServerItemHasAssist(Device device); - void playBack(String deviceId, String channelId, String startTime, String endTime, InviteErrorCallback callback); - void playBack(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, String deviceId, String channelId, String startTime, String endTime, InviteErrorCallback callback); + void playBack(String deviceId, String channelId, String startTime, String endTime, ErrorCallback callback); + void playBack(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, String deviceId, String channelId, String startTime, String endTime, ErrorCallback callback); void zlmServerOffline(String mediaServerId); - void download(String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, InviteErrorCallback callback); - void download(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo,String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, InviteErrorCallback callback); + void download(String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback callback); + void download(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo,String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback callback); StreamInfo getDownLoadInfo(String deviceId, String channelId, String stream); @@ -42,4 +42,6 @@ public interface IPlayService { void pauseRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException; void resumeRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException; + + void getSnap(String deviceId, String channelId, String fileName, ErrorCallback errorCallback); } diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/InviteErrorCallback.java b/src/main/java/com/genersoft/iot/vmp/service/bean/ErrorCallback.java similarity index 68% rename from src/main/java/com/genersoft/iot/vmp/service/bean/InviteErrorCallback.java rename to src/main/java/com/genersoft/iot/vmp/service/bean/ErrorCallback.java index 974057e5..6211d003 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/bean/InviteErrorCallback.java +++ b/src/main/java/com/genersoft/iot/vmp/service/bean/ErrorCallback.java @@ -1,6 +1,6 @@ package com.genersoft.iot.vmp.service.bean; -public interface InviteErrorCallback { +public interface ErrorCallback { void run(int code, String msg, T data); } diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/InviteErrorCode.java b/src/main/java/com/genersoft/iot/vmp/service/bean/InviteErrorCode.java index 16c112b6..d43792e7 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/bean/InviteErrorCode.java +++ b/src/main/java/com/genersoft/iot/vmp/service/bean/InviteErrorCode.java @@ -5,6 +5,7 @@ package com.genersoft.iot.vmp.service.bean; */ public enum InviteErrorCode { SUCCESS(0, "成功"), + FAIL(-100, "失败"), ERROR_FOR_SIGNALLING_TIMEOUT(-1, "信令超时"), ERROR_FOR_STREAM_TIMEOUT(-2, "收流超时"), ERROR_FOR_RESOURCE_EXHAUSTION(-3, "资源耗尽"), diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java index f067cf06..19e82d49 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java @@ -6,7 +6,7 @@ import com.genersoft.iot.vmp.common.InviteSessionStatus; import com.genersoft.iot.vmp.common.InviteSessionType; import com.genersoft.iot.vmp.common.VideoManagerConstants; import com.genersoft.iot.vmp.service.IInviteStreamService; -import com.genersoft.iot.vmp.service.bean.InviteErrorCallback; +import com.genersoft.iot.vmp.service.bean.ErrorCallback; import com.genersoft.iot.vmp.utils.redis.RedisUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,7 +24,7 @@ public class InviteStreamServiceImpl implements IInviteStreamService { private final Logger logger = LoggerFactory.getLogger(InviteStreamServiceImpl.class); - private final Map>> inviteErrorCallbackMap = new ConcurrentHashMap<>(); + private final Map>> inviteErrorCallbackMap = new ConcurrentHashMap<>(); @Autowired private RedisTemplate redisTemplate; @@ -141,9 +141,9 @@ public class InviteStreamServiceImpl implements IInviteStreamService { } @Override - public void once(InviteSessionType type, String deviceId, String channelId, String stream, InviteErrorCallback callback) { + public void once(InviteSessionType type, String deviceId, String channelId, String stream, ErrorCallback callback) { String key = buildKey(type, deviceId, channelId, stream); - List> callbacks = inviteErrorCallbackMap.get(key); + List> callbacks = inviteErrorCallbackMap.get(key); if (callbacks == null) { callbacks = new CopyOnWriteArrayList<>(); inviteErrorCallbackMap.put(key, callbacks); @@ -155,11 +155,11 @@ public class InviteStreamServiceImpl implements IInviteStreamService { @Override public void call(InviteSessionType type, String deviceId, String channelId, String stream, int code, String msg, Object data) { String key = buildKey(type, deviceId, channelId, stream); - List> callbacks = inviteErrorCallbackMap.get(key); + List> callbacks = inviteErrorCallbackMap.get(key); if (callbacks == null) { return; } - for (InviteErrorCallback callback : callbacks) { + for (ErrorCallback callback : callbacks) { callback.run(code, msg, data); } inviteErrorCallbackMap.remove(key); diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index 661a2ec7..a12cf23b 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -26,7 +26,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.service.*; -import com.genersoft.iot.vmp.service.bean.InviteErrorCallback; +import com.genersoft.iot.vmp.service.bean.ErrorCallback; import com.genersoft.iot.vmp.service.bean.InviteErrorCode; import com.genersoft.iot.vmp.service.bean.SSRCInfo; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; @@ -44,6 +44,7 @@ import javax.sdp.*; import javax.sip.InvalidArgumentException; import javax.sip.ResponseEvent; import javax.sip.SipException; +import java.io.File; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.ParseException; @@ -114,7 +115,7 @@ public class PlayServiceImpl implements IPlayService { @Override - public SSRCInfo play(MediaServerItem mediaServerItem, String deviceId, String channelId, InviteErrorCallback callback) { + public SSRCInfo play(MediaServerItem mediaServerItem, String deviceId, String channelId, ErrorCallback callback) { if (mediaServerItem == null) { throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到可用的zlm"); } @@ -179,7 +180,7 @@ public class PlayServiceImpl implements IPlayService { @Override public void play(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, - InviteErrorCallback callback) { + ErrorCallback callback) { if (mediaServerItem == null || ssrcInfo == null) { callback.run(InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getCode(), @@ -522,7 +523,7 @@ public class PlayServiceImpl implements IPlayService { @Override public void playBack(String deviceId, String channelId, String startTime, - String endTime, InviteErrorCallback callback) { + String endTime, ErrorCallback callback) { Device device = storager.queryVideoDevice(deviceId); if (device == null) { return; @@ -535,7 +536,7 @@ public class PlayServiceImpl implements IPlayService { @Override public void playBack(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, String deviceId, String channelId, String startTime, - String endTime, InviteErrorCallback callback) { + String endTime, ErrorCallback callback) { if (mediaServerItem == null || ssrcInfo == null) { callback.run(InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getCode(), InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getMsg(), @@ -725,7 +726,7 @@ public class PlayServiceImpl implements IPlayService { @Override - public void download(String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, InviteErrorCallback callback) { + public void download(String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback callback) { Device device = storager.queryVideoDevice(deviceId); if (device == null) { return; @@ -743,7 +744,7 @@ public class PlayServiceImpl implements IPlayService { @Override - public void download(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, InviteErrorCallback callback) { + public void download(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback callback) { if (mediaServerItem == null || ssrcInfo == null) { callback.run(InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getCode(), InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getMsg(), @@ -1127,4 +1128,53 @@ public class PlayServiceImpl implements IPlayService { Device device = storager.queryVideoDevice(inviteInfo.getDeviceId()); cmder.playResumeCmd(device, inviteInfo.getStreamInfo()); } + + @Override + public void getSnap(String deviceId, String channelId, String fileName, ErrorCallback errorCallback) { + Device device = deviceService.getDevice(deviceId); + if (device == null) { + errorCallback.run(InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getCode(), InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getMsg(), null); + return; + } + + InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId); + if (inviteInfo != null) { + if (inviteInfo.getStreamInfo() != null) { + // 已存在线直接截图 + MediaServerItem mediaServerItemInuse = mediaServerService.getOne(inviteInfo.getStreamInfo().getMediaServerId()); + String streamUrl; + if (mediaServerItemInuse.getRtspPort() != 0) { + streamUrl = String.format("rtsp://127.0.0.1:%s/%s/%s", mediaServerItemInuse.getRtspPort(), "rtp", inviteInfo.getStreamInfo().getStream()); + }else { + streamUrl = String.format("http://127.0.0.1:%s/%s/%s.live.mp4", mediaServerItemInuse.getHttpPort(), "rtp", inviteInfo.getStreamInfo().getStream()); + } + String path = "snap"; + // 请求截图 + logger.info("[请求截图]: " + fileName); + zlmresTfulUtils.getSnap(mediaServerItemInuse, streamUrl, 15, 1, path, fileName); + File snapFile = new File(path + File.separator + fileName); + if (snapFile.exists()) { + errorCallback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), snapFile.getAbsoluteFile()); + }else { + errorCallback.run(InviteErrorCode.FAIL.getCode(), InviteErrorCode.FAIL.getMsg(), null); + } + return; + } + } + + MediaServerItem newMediaServerItem = getNewMediaServerItem(device); + play(newMediaServerItem, deviceId, channelId, (code, msg, data)->{ + if (code == InviteErrorCode.SUCCESS.getCode()) { + InviteInfo inviteInfoForPlay = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId); + if (inviteInfoForPlay != null && inviteInfoForPlay.getStreamInfo() != null) { + getSnap(deviceId, channelId, fileName, errorCallback); + }else { + errorCallback.run(InviteErrorCode.FAIL.getCode(), InviteErrorCode.FAIL.getMsg(), null); + } + }else { + errorCallback.run(InviteErrorCode.FAIL.getCode(), InviteErrorCode.FAIL.getMsg(), null); + } + }); + } + } diff --git a/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java b/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java index 251570a9..7a65a610 100644 --- a/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java +++ b/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java @@ -32,11 +32,17 @@ public class DateUtil { */ public static final String PATTERN = "yyyy-MM-dd HH:mm:ss"; + /** + * wvp内部统一时间格式 + */ + public static final String URL_PATTERN = "yyyyMMddHHmmss"; + public static final String zoneStr = "Asia/Shanghai"; public static final DateTimeFormatter formatterCompatibleISO8601 = DateTimeFormatter.ofPattern(ISO8601_COMPATIBLE_PATTERN, Locale.getDefault()).withZone(ZoneId.of(zoneStr)); public static final DateTimeFormatter formatterISO8601 = DateTimeFormatter.ofPattern(ISO8601_PATTERN, Locale.getDefault()).withZone(ZoneId.of(zoneStr)); public static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(PATTERN, Locale.getDefault()).withZone(ZoneId.of(zoneStr)); + public static final DateTimeFormatter urlFormatter = DateTimeFormatter.ofPattern(URL_PATTERN, Locale.getDefault()).withZone(ZoneId.of(zoneStr)); public static String yyyy_MM_dd_HH_mm_ssToISO8601(String formatTime) { @@ -67,6 +73,15 @@ public class DateUtil { return formatter.format(nowDateTime); } + /** + * 获取当前时间 + * @return + */ + public static String getNowForUrl() { + LocalDateTime nowDateTime = LocalDateTime.now(); + return urlFormatter.format(nowDateTime); + } + /** * 格式校验 * @param timeStr 时间字符串 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 a4fa8ddf..eae34758 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 @@ -24,6 +24,7 @@ import com.genersoft.iot.vmp.service.IPlayService; import com.genersoft.iot.vmp.service.bean.InviteErrorCode; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; 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.StreamContent; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; @@ -337,5 +338,35 @@ public class PlayController { return jsonObject; } + @Operation(summary = "获取截图") + @Parameter(name = "deviceId", description = "设备国标编号", required = true) + @Parameter(name = "channelId", description = "通道国标编号", required = true) + @GetMapping("/snap") + public DeferredResult getSnap(String deviceId, String channelId) { + if (logger.isDebugEnabled()) { + logger.debug("获取截图: {}/{}", deviceId, channelId); + } + + DeferredResult result = new DeferredResult<>(3 * 1000L); + String key = DeferredResultHolder.CALLBACK_CMD_SNAP + deviceId; + String uuid = UUID.randomUUID().toString(); + resultHolder.put(key, uuid, result); + + RequestMessage message = new RequestMessage(); + message.setKey(key); + message.setId(uuid); + + String fileName = deviceId + "_" + channelId + "_" + DateUtil.getNowForUrl() + "jpg"; + playService.getSnap(deviceId, channelId, fileName, (code, msg, data) -> { + if (code == InviteErrorCode.SUCCESS.getCode()) { + message.setData(data); + }else { + message.setData(WVPResult.fail(code, msg)); + } + resultHolder.invokeResult(message); + }); + return result; + } + }