Commit f24b6fa13f5eed916ab09d7807a11c92b186e992
1 parent
042b28b2
优化国标录像的异常判断
Showing
6 changed files
with
59 additions
and
23 deletions
src/main/java/com/genersoft/iot/vmp/service/IPlayService.java
| @@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | @@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | ||
| 11 | import com.genersoft.iot.vmp.service.bean.InviteTimeOutCallback; | 11 | import com.genersoft.iot.vmp.service.bean.InviteTimeOutCallback; |
| 12 | import com.genersoft.iot.vmp.service.bean.PlayBackCallback; | 12 | import com.genersoft.iot.vmp.service.bean.PlayBackCallback; |
| 13 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; | 13 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 14 | +import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | ||
| 14 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; | 15 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; |
| 15 | import org.springframework.http.ResponseEntity; | 16 | import org.springframework.http.ResponseEntity; |
| 16 | import org.springframework.web.context.request.async.DeferredResult; | 17 | import org.springframework.web.context.request.async.DeferredResult; |
| @@ -31,13 +32,13 @@ public interface IPlayService { | @@ -31,13 +32,13 @@ public interface IPlayService { | ||
| 31 | 32 | ||
| 32 | void onPublishHandlerForDownload(InviteStreamInfo inviteStreamInfo, String deviceId, String channelId, String toString); | 33 | void onPublishHandlerForDownload(InviteStreamInfo inviteStreamInfo, String deviceId, String channelId, String toString); |
| 33 | 34 | ||
| 34 | - DeferredResult<String> playBack(String deviceId, String channelId, String startTime, String endTime, InviteStreamCallback infoCallBack, PlayBackCallback hookCallBack); | ||
| 35 | - DeferredResult<String> playBack(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo,String deviceId, String channelId, String startTime, String endTime, InviteStreamCallback infoCallBack, PlayBackCallback hookCallBack); | 35 | + DeferredResult<WVPResult<StreamInfo>> playBack(String deviceId, String channelId, String startTime, String endTime, InviteStreamCallback infoCallBack, PlayBackCallback hookCallBack); |
| 36 | + DeferredResult<WVPResult<StreamInfo>> playBack(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo,String deviceId, String channelId, String startTime, String endTime, InviteStreamCallback infoCallBack, PlayBackCallback hookCallBack); | ||
| 36 | 37 | ||
| 37 | void zlmServerOffline(String mediaServerId); | 38 | void zlmServerOffline(String mediaServerId); |
| 38 | 39 | ||
| 39 | - DeferredResult<String> download(String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, InviteStreamCallback infoCallBack, PlayBackCallback hookCallBack); | ||
| 40 | - DeferredResult<String> download(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo,String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, InviteStreamCallback infoCallBack, PlayBackCallback hookCallBack); | 40 | + DeferredResult<WVPResult<StreamInfo>> download(String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, InviteStreamCallback infoCallBack, PlayBackCallback hookCallBack); |
| 41 | + DeferredResult<WVPResult<StreamInfo>> download(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo,String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, InviteStreamCallback infoCallBack, PlayBackCallback hookCallBack); | ||
| 41 | 42 | ||
| 42 | StreamInfo getDownLoadInfo(String deviceId, String channelId, String stream); | 43 | StreamInfo getDownLoadInfo(String deviceId, String channelId, String stream); |
| 43 | 44 |
src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackResult.java
| @@ -12,6 +12,8 @@ import java.util.EventObject; | @@ -12,6 +12,8 @@ import java.util.EventObject; | ||
| 12 | */ | 12 | */ |
| 13 | public class PlayBackResult<T> { | 13 | public class PlayBackResult<T> { |
| 14 | private int code; | 14 | private int code; |
| 15 | + | ||
| 16 | + private String msg; | ||
| 15 | private T data; | 17 | private T data; |
| 16 | private MediaServerItem mediaServerItem; | 18 | private MediaServerItem mediaServerItem; |
| 17 | private JSONObject response; | 19 | private JSONObject response; |
| @@ -56,4 +58,12 @@ public class PlayBackResult<T> { | @@ -56,4 +58,12 @@ public class PlayBackResult<T> { | ||
| 56 | public void setEvent(SipSubscribe.EventResult<EventObject> event) { | 58 | public void setEvent(SipSubscribe.EventResult<EventObject> event) { |
| 57 | this.event = event; | 59 | this.event = event; |
| 58 | } | 60 | } |
| 61 | + | ||
| 62 | + public String getMsg() { | ||
| 63 | + return msg; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public void setMsg(String msg) { | ||
| 67 | + this.msg = msg; | ||
| 68 | + } | ||
| 59 | } | 69 | } |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -384,7 +384,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -384,7 +384,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | @Override | 386 | @Override |
| 387 | - public DeferredResult<String> playBack(String deviceId, String channelId, String startTime, | 387 | + public DeferredResult<WVPResult<StreamInfo>> playBack(String deviceId, String channelId, String startTime, |
| 388 | String endTime,InviteStreamCallback inviteStreamCallback, | 388 | String endTime,InviteStreamCallback inviteStreamCallback, |
| 389 | PlayBackCallback callback) { | 389 | PlayBackCallback callback) { |
| 390 | Device device = storager.queryVideoDevice(deviceId); | 390 | Device device = storager.queryVideoDevice(deviceId); |
| @@ -398,7 +398,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -398,7 +398,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | @Override | 400 | @Override |
| 401 | - public DeferredResult<String> playBack(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, | 401 | + public DeferredResult<WVPResult<StreamInfo>> playBack(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, |
| 402 | String deviceId, String channelId, String startTime, | 402 | String deviceId, String channelId, String startTime, |
| 403 | String endTime, InviteStreamCallback infoCallBack, | 403 | String endTime, InviteStreamCallback infoCallBack, |
| 404 | PlayBackCallback playBackCallback) { | 404 | PlayBackCallback playBackCallback) { |
| @@ -411,7 +411,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -411,7 +411,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 411 | if (device == null) { | 411 | if (device == null) { |
| 412 | throw new ControllerException(ErrorCode.ERROR100.getCode(), "设备: " + deviceId + "不存在"); | 412 | throw new ControllerException(ErrorCode.ERROR100.getCode(), "设备: " + deviceId + "不存在"); |
| 413 | } | 413 | } |
| 414 | - DeferredResult<String> result = new DeferredResult<>(30000L); | 414 | + DeferredResult<WVPResult<StreamInfo>> result = new DeferredResult<>(30000L); |
| 415 | resultHolder.put(DeferredResultHolder.CALLBACK_CMD_PLAYBACK + deviceId + channelId, uuid, result); | 415 | resultHolder.put(DeferredResultHolder.CALLBACK_CMD_PLAYBACK + deviceId + channelId, uuid, result); |
| 416 | RequestMessage requestMessage = new RequestMessage(); | 416 | RequestMessage requestMessage = new RequestMessage(); |
| 417 | requestMessage.setId(uuid); | 417 | requestMessage.setId(uuid); |
| @@ -420,7 +420,8 @@ public class PlayServiceImpl implements IPlayService { | @@ -420,7 +420,8 @@ public class PlayServiceImpl implements IPlayService { | ||
| 420 | String playBackTimeOutTaskKey = UUID.randomUUID().toString(); | 420 | String playBackTimeOutTaskKey = UUID.randomUUID().toString(); |
| 421 | dynamicTask.startDelay(playBackTimeOutTaskKey, ()->{ | 421 | dynamicTask.startDelay(playBackTimeOutTaskKey, ()->{ |
| 422 | logger.warn(String.format("设备回放超时,deviceId:%s ,channelId:%s", deviceId, channelId)); | 422 | logger.warn(String.format("设备回放超时,deviceId:%s ,channelId:%s", deviceId, channelId)); |
| 423 | - playBackResult.setCode(-1); | 423 | + playBackResult.setCode(ErrorCode.ERROR100.getCode()); |
| 424 | + playBackResult.setMsg("回放超时"); | ||
| 424 | playBackResult.setData(requestMessage); | 425 | playBackResult.setData(requestMessage); |
| 425 | SIPDialog dialog = streamSession.getDialogByStream(deviceId, channelId, ssrcInfo.getStream()); | 426 | SIPDialog dialog = streamSession.getDialogByStream(deviceId, channelId, ssrcInfo.getStream()); |
| 426 | // 点播超时回复BYE 同时释放ssrc以及此次点播的资源 | 427 | // 点播超时回复BYE 同时释放ssrc以及此次点播的资源 |
| @@ -435,6 +436,8 @@ public class PlayServiceImpl implements IPlayService { | @@ -435,6 +436,8 @@ public class PlayServiceImpl implements IPlayService { | ||
| 435 | cmder.streamByeCmd(device.getDeviceId(), channelId, ssrcInfo.getStream(), null); | 436 | cmder.streamByeCmd(device.getDeviceId(), channelId, ssrcInfo.getStream(), null); |
| 436 | // 回复之前所有的点播请求 | 437 | // 回复之前所有的点播请求 |
| 437 | playBackCallback.call(playBackResult); | 438 | playBackCallback.call(playBackResult); |
| 439 | + result.setResult(WVPResult.fail(ErrorCode.ERROR100.getCode(), "回放超时")); | ||
| 440 | + resultHolder.exist(DeferredResultHolder.CALLBACK_CMD_PLAYBACK + deviceId + channelId, uuid); | ||
| 438 | }, userSetting.getPlayTimeout()); | 441 | }, userSetting.getPlayTimeout()); |
| 439 | 442 | ||
| 440 | cmder.playbackStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, infoCallBack, | 443 | cmder.playbackStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, infoCallBack, |
| @@ -444,14 +447,16 @@ public class PlayServiceImpl implements IPlayService { | @@ -444,14 +447,16 @@ public class PlayServiceImpl implements IPlayService { | ||
| 444 | StreamInfo streamInfo = onPublishHandler(inviteStreamInfo.getMediaServerItem(), inviteStreamInfo.getResponse(), deviceId, channelId); | 447 | StreamInfo streamInfo = onPublishHandler(inviteStreamInfo.getMediaServerItem(), inviteStreamInfo.getResponse(), deviceId, channelId); |
| 445 | if (streamInfo == null) { | 448 | if (streamInfo == null) { |
| 446 | logger.warn("设备回放API调用失败!"); | 449 | logger.warn("设备回放API调用失败!"); |
| 447 | - playBackResult.setCode(-1); | 450 | + playBackResult.setCode(ErrorCode.ERROR100.getCode()); |
| 451 | + playBackResult.setMsg("设备回放API调用失败!"); | ||
| 448 | playBackCallback.call(playBackResult); | 452 | playBackCallback.call(playBackResult); |
| 449 | return; | 453 | return; |
| 450 | } | 454 | } |
| 451 | redisCatchStorage.startPlayback(streamInfo, inviteStreamInfo.getCallId()); | 455 | redisCatchStorage.startPlayback(streamInfo, inviteStreamInfo.getCallId()); |
| 452 | WVPResult<StreamInfo> success = WVPResult.success(streamInfo); | 456 | WVPResult<StreamInfo> success = WVPResult.success(streamInfo); |
| 453 | requestMessage.setData(success); | 457 | requestMessage.setData(success); |
| 454 | - playBackResult.setCode(0); | 458 | + playBackResult.setCode(ErrorCode.SUCCESS.getCode()); |
| 459 | + playBackResult.setMsg(ErrorCode.SUCCESS.getMsg()); | ||
| 455 | playBackResult.setData(requestMessage); | 460 | playBackResult.setData(requestMessage); |
| 456 | playBackResult.setMediaServerItem(inviteStreamInfo.getMediaServerItem()); | 461 | playBackResult.setMediaServerItem(inviteStreamInfo.getMediaServerItem()); |
| 457 | playBackResult.setResponse(inviteStreamInfo.getResponse()); | 462 | playBackResult.setResponse(inviteStreamInfo.getResponse()); |
| @@ -459,7 +464,8 @@ public class PlayServiceImpl implements IPlayService { | @@ -459,7 +464,8 @@ public class PlayServiceImpl implements IPlayService { | ||
| 459 | }, event -> { | 464 | }, event -> { |
| 460 | dynamicTask.stop(playBackTimeOutTaskKey); | 465 | dynamicTask.stop(playBackTimeOutTaskKey); |
| 461 | requestMessage.setData(WVPResult.fail(ErrorCode.ERROR100.getCode(), String.format("回放失败, 错误码: %s, %s", event.statusCode, event.msg))); | 466 | requestMessage.setData(WVPResult.fail(ErrorCode.ERROR100.getCode(), String.format("回放失败, 错误码: %s, %s", event.statusCode, event.msg))); |
| 462 | - playBackResult.setCode(-1); | 467 | + playBackResult.setCode(ErrorCode.ERROR100.getCode()); |
| 468 | + playBackResult.setMsg(String.format("回放失败, 错误码: %s, %s", event.statusCode, event.msg)); | ||
| 463 | playBackResult.setData(requestMessage); | 469 | playBackResult.setData(requestMessage); |
| 464 | playBackResult.setEvent(event); | 470 | playBackResult.setEvent(event); |
| 465 | playBackCallback.call(playBackResult); | 471 | playBackCallback.call(playBackResult); |
| @@ -469,7 +475,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -469,7 +475,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 469 | } | 475 | } |
| 470 | 476 | ||
| 471 | @Override | 477 | @Override |
| 472 | - public DeferredResult<String> download(String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, InviteStreamCallback infoCallBack, PlayBackCallback hookCallBack) { | 478 | + public DeferredResult<WVPResult<StreamInfo>> download(String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, InviteStreamCallback infoCallBack, PlayBackCallback hookCallBack) { |
| 473 | Device device = storager.queryVideoDevice(deviceId); | 479 | Device device = storager.queryVideoDevice(deviceId); |
| 474 | if (device == null) { | 480 | if (device == null) { |
| 475 | return null; | 481 | return null; |
| @@ -481,13 +487,13 @@ public class PlayServiceImpl implements IPlayService { | @@ -481,13 +487,13 @@ public class PlayServiceImpl implements IPlayService { | ||
| 481 | } | 487 | } |
| 482 | 488 | ||
| 483 | @Override | 489 | @Override |
| 484 | - public DeferredResult<String> download(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, InviteStreamCallback infoCallBack, PlayBackCallback hookCallBack) { | 490 | + public DeferredResult<WVPResult<StreamInfo>> download(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, InviteStreamCallback infoCallBack, PlayBackCallback hookCallBack) { |
| 485 | if (mediaServerItem == null || ssrcInfo == null) { | 491 | if (mediaServerItem == null || ssrcInfo == null) { |
| 486 | return null; | 492 | return null; |
| 487 | } | 493 | } |
| 488 | String uuid = UUID.randomUUID().toString(); | 494 | String uuid = UUID.randomUUID().toString(); |
| 489 | String key = DeferredResultHolder.CALLBACK_CMD_DOWNLOAD + deviceId + channelId; | 495 | String key = DeferredResultHolder.CALLBACK_CMD_DOWNLOAD + deviceId + channelId; |
| 490 | - DeferredResult<String> result = new DeferredResult<>(30000L); | 496 | + DeferredResult<WVPResult<StreamInfo>> result = new DeferredResult<>(30000L); |
| 491 | Device device = storager.queryVideoDevice(deviceId); | 497 | Device device = storager.queryVideoDevice(deviceId); |
| 492 | if (device == null) { | 498 | if (device == null) { |
| 493 | throw new ControllerException(ErrorCode.ERROR400.getCode(), "设备:" + deviceId + "不存在"); | 499 | throw new ControllerException(ErrorCode.ERROR400.getCode(), "设备:" + deviceId + "不存在"); |
| @@ -507,7 +513,8 @@ public class PlayServiceImpl implements IPlayService { | @@ -507,7 +513,8 @@ public class PlayServiceImpl implements IPlayService { | ||
| 507 | logger.warn(String.format("录像下载请求超时,deviceId:%s ,channelId:%s", deviceId, channelId)); | 513 | logger.warn(String.format("录像下载请求超时,deviceId:%s ,channelId:%s", deviceId, channelId)); |
| 508 | wvpResult.setCode(ErrorCode.ERROR100.getCode()); | 514 | wvpResult.setCode(ErrorCode.ERROR100.getCode()); |
| 509 | wvpResult.setMsg("录像下载请求超时"); | 515 | wvpResult.setMsg("录像下载请求超时"); |
| 510 | - downloadResult.setCode(-1); | 516 | + downloadResult.setCode(ErrorCode.ERROR100.getCode()); |
| 517 | + downloadResult.setMsg("录像下载请求超时"); | ||
| 511 | hookCallBack.call(downloadResult); | 518 | hookCallBack.call(downloadResult); |
| 512 | SIPDialog dialog = streamSession.getDialogByStream(deviceId, channelId, ssrcInfo.getStream()); | 519 | SIPDialog dialog = streamSession.getDialogByStream(deviceId, channelId, ssrcInfo.getStream()); |
| 513 | // 点播超时回复BYE 同时释放ssrc以及此次点播的资源 | 520 | // 点播超时回复BYE 同时释放ssrc以及此次点播的资源 |
| @@ -534,13 +541,15 @@ public class PlayServiceImpl implements IPlayService { | @@ -534,13 +541,15 @@ public class PlayServiceImpl implements IPlayService { | ||
| 534 | wvpResult.setCode(ErrorCode.SUCCESS.getCode()); | 541 | wvpResult.setCode(ErrorCode.SUCCESS.getCode()); |
| 535 | wvpResult.setMsg(ErrorCode.SUCCESS.getMsg()); | 542 | wvpResult.setMsg(ErrorCode.SUCCESS.getMsg()); |
| 536 | wvpResult.setData(streamInfo); | 543 | wvpResult.setData(streamInfo); |
| 537 | - downloadResult.setCode(0); | 544 | + downloadResult.setCode(ErrorCode.SUCCESS.getCode()); |
| 545 | + downloadResult.setMsg(ErrorCode.SUCCESS.getMsg()); | ||
| 538 | downloadResult.setMediaServerItem(inviteStreamInfo.getMediaServerItem()); | 546 | downloadResult.setMediaServerItem(inviteStreamInfo.getMediaServerItem()); |
| 539 | downloadResult.setResponse(inviteStreamInfo.getResponse()); | 547 | downloadResult.setResponse(inviteStreamInfo.getResponse()); |
| 540 | hookCallBack.call(downloadResult); | 548 | hookCallBack.call(downloadResult); |
| 541 | }, event -> { | 549 | }, event -> { |
| 542 | dynamicTask.stop(downLoadTimeOutTaskKey); | 550 | dynamicTask.stop(downLoadTimeOutTaskKey); |
| 543 | - downloadResult.setCode(-1); | 551 | + downloadResult.setCode(ErrorCode.ERROR100.getCode()); |
| 552 | + downloadResult.setMsg(String.format("录像下载失败, 错误码: %s, %s", event.statusCode, event.msg)); | ||
| 544 | wvpResult.setCode(ErrorCode.ERROR100.getCode()); | 553 | wvpResult.setCode(ErrorCode.ERROR100.getCode()); |
| 545 | wvpResult.setMsg(String.format("录像下载失败, 错误码: %s, %s", event.statusCode, event.msg)); | 554 | wvpResult.setMsg(String.format("录像下载失败, 错误码: %s, %s", event.statusCode, event.msg)); |
| 546 | downloadResult.setEvent(event); | 555 | downloadResult.setEvent(event); |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
| @@ -3,9 +3,11 @@ package com.genersoft.iot.vmp.vmanager.gb28181.playback; | @@ -3,9 +3,11 @@ package com.genersoft.iot.vmp.vmanager.gb28181.playback; | ||
| 3 | import com.genersoft.iot.vmp.common.StreamInfo; | 3 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 4 | import com.genersoft.iot.vmp.conf.exception.ControllerException; | 4 | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| 5 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 5 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 6 | +import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | ||
| 6 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 7 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 7 | import com.genersoft.iot.vmp.service.IPlayService; | 8 | import com.genersoft.iot.vmp.service.IPlayService; |
| 8 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; | 9 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 10 | +import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | ||
| 9 | import io.swagger.v3.oas.annotations.Operation; | 11 | import io.swagger.v3.oas.annotations.Operation; |
| 10 | import io.swagger.v3.oas.annotations.Parameter; | 12 | import io.swagger.v3.oas.annotations.Parameter; |
| 11 | import io.swagger.v3.oas.annotations.tags.Tag; | 13 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -57,8 +59,8 @@ public class PlaybackController { | @@ -57,8 +59,8 @@ public class PlaybackController { | ||
| 57 | @Parameter(name = "startTime", description = "开始时间", required = true) | 59 | @Parameter(name = "startTime", description = "开始时间", required = true) |
| 58 | @Parameter(name = "endTime", description = "结束时间", required = true) | 60 | @Parameter(name = "endTime", description = "结束时间", required = true) |
| 59 | @GetMapping("/start/{deviceId}/{channelId}") | 61 | @GetMapping("/start/{deviceId}/{channelId}") |
| 60 | - public DeferredResult<String> play(@PathVariable String deviceId, @PathVariable String channelId, | ||
| 61 | - String startTime,String endTime) { | 62 | + public DeferredResult<WVPResult<StreamInfo>> play(@PathVariable String deviceId, @PathVariable String channelId, |
| 63 | + String startTime, String endTime) { | ||
| 62 | 64 | ||
| 63 | if (logger.isDebugEnabled()) { | 65 | if (logger.isDebugEnabled()) { |
| 64 | logger.debug(String.format("设备回放 API调用,deviceId:%s ,channelId:%s", deviceId, channelId)); | 66 | logger.debug(String.format("设备回放 API调用,deviceId:%s ,channelId:%s", deviceId, channelId)); |
| @@ -66,7 +68,15 @@ public class PlaybackController { | @@ -66,7 +68,15 @@ public class PlaybackController { | ||
| 66 | 68 | ||
| 67 | 69 | ||
| 68 | return playService.playBack(deviceId, channelId, startTime, endTime, null, | 70 | return playService.playBack(deviceId, channelId, startTime, endTime, null, |
| 69 | - playBackResult->resultHolder.invokeResult(playBackResult.getData())); | 71 | + playBackResult->{ |
| 72 | + if (playBackResult.getCode() != ErrorCode.SUCCESS.getCode()) { | ||
| 73 | + RequestMessage data = playBackResult.getData(); | ||
| 74 | + data.setData(WVPResult.fail(playBackResult.getCode(), playBackResult.getMsg())); | ||
| 75 | + resultHolder.invokeResult(data); | ||
| 76 | + }else { | ||
| 77 | + resultHolder.invokeResult(playBackResult.getData()); | ||
| 78 | + } | ||
| 79 | + }); | ||
| 70 | } | 80 | } |
| 71 | 81 | ||
| 72 | 82 |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java
| @@ -110,14 +110,14 @@ public class GBRecordController { | @@ -110,14 +110,14 @@ public class GBRecordController { | ||
| 110 | @Parameter(name = "endTime", description = "结束时间", required = true) | 110 | @Parameter(name = "endTime", description = "结束时间", required = true) |
| 111 | @Parameter(name = "downloadSpeed", description = "下载倍速", required = true) | 111 | @Parameter(name = "downloadSpeed", description = "下载倍速", required = true) |
| 112 | @GetMapping("/download/start/{deviceId}/{channelId}") | 112 | @GetMapping("/download/start/{deviceId}/{channelId}") |
| 113 | - public DeferredResult<String> download(@PathVariable String deviceId, @PathVariable String channelId, | 113 | + public DeferredResult<WVPResult<StreamInfo>> download(@PathVariable String deviceId, @PathVariable String channelId, |
| 114 | String startTime, String endTime, String downloadSpeed) { | 114 | String startTime, String endTime, String downloadSpeed) { |
| 115 | 115 | ||
| 116 | if (logger.isDebugEnabled()) { | 116 | if (logger.isDebugEnabled()) { |
| 117 | logger.debug(String.format("历史媒体下载 API调用,deviceId:%s,channelId:%s,downloadSpeed:%s", deviceId, channelId, downloadSpeed)); | 117 | logger.debug(String.format("历史媒体下载 API调用,deviceId:%s,channelId:%s,downloadSpeed:%s", deviceId, channelId, downloadSpeed)); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | - DeferredResult<String> result = playService.download(deviceId, channelId, startTime, endTime, Integer.parseInt(downloadSpeed), null, hookCallBack->{ | 120 | + DeferredResult<WVPResult<StreamInfo>> result = playService.download(deviceId, channelId, startTime, endTime, Integer.parseInt(downloadSpeed), null, hookCallBack->{ |
| 121 | resultHolder.invokeResult(hookCallBack.getData()); | 121 | resultHolder.invokeResult(hookCallBack.getData()); |
| 122 | }); | 122 | }); |
| 123 | 123 |
web_src/src/components/dialog/devicePlayer.vue
| @@ -564,10 +564,10 @@ export default { | @@ -564,10 +564,10 @@ export default { | ||
| 564 | url: '/api/gb_record/query/' + this.deviceId + '/' + this.channelId + '?startTime=' + startTime + '&endTime=' + endTime | 564 | url: '/api/gb_record/query/' + this.deviceId + '/' + this.channelId + '?startTime=' + startTime + '&endTime=' + endTime |
| 565 | }).then(function (res) { | 565 | }).then(function (res) { |
| 566 | console.log(res) | 566 | console.log(res) |
| 567 | + that.recordsLoading = false; | ||
| 567 | if(res.data.code === 0) { | 568 | if(res.data.code === 0) { |
| 568 | // 处理时间信息 | 569 | // 处理时间信息 |
| 569 | that.videoHistory.searchHistoryResult = res.data.data.recordList; | 570 | that.videoHistory.searchHistoryResult = res.data.data.recordList; |
| 570 | - that.recordsLoading = false; | ||
| 571 | }else { | 571 | }else { |
| 572 | this.$message({ | 572 | this.$message({ |
| 573 | showClose: true, | 573 | showClose: true, |
| @@ -613,6 +613,12 @@ export default { | @@ -613,6 +613,12 @@ export default { | ||
| 613 | that.mediaServerId = that.streamInfo.mediaServerId; | 613 | that.mediaServerId = that.streamInfo.mediaServerId; |
| 614 | that.ssrc = that.streamInfo.ssrc; | 614 | that.ssrc = that.streamInfo.ssrc; |
| 615 | that.videoUrl = that.getUrlByStreamInfo(); | 615 | that.videoUrl = that.getUrlByStreamInfo(); |
| 616 | + }else { | ||
| 617 | + that.$message({ | ||
| 618 | + showClose: true, | ||
| 619 | + message: res.data.msg, | ||
| 620 | + type: "error", | ||
| 621 | + }); | ||
| 616 | } | 622 | } |
| 617 | that.recordPlay = true; | 623 | that.recordPlay = true; |
| 618 | }); | 624 | }); |