Commit 042b28b2d62860db912b254420fb4172880aafab
1 parent
5461b8eb
支持全局异常和统一返回结果
Showing
31 changed files
with
460 additions
and
185 deletions
src/main/java/com/genersoft/iot/vmp/conf/GlobalResponseAdvice.java
| @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.conf; | @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.conf; | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; | 4 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 5 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 5 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 6 | +import org.jetbrains.annotations.NotNull; | ||
| 6 | import org.springframework.core.MethodParameter; | 7 | import org.springframework.core.MethodParameter; |
| 7 | import org.springframework.http.MediaType; | 8 | import org.springframework.http.MediaType; |
| 8 | import org.springframework.http.converter.HttpMessageConverter; | 9 | import org.springframework.http.converter.HttpMessageConverter; |
| @@ -13,20 +14,21 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; | @@ -13,20 +14,21 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; | ||
| 13 | 14 | ||
| 14 | /** | 15 | /** |
| 15 | * 全局统一返回结果 | 16 | * 全局统一返回结果 |
| 17 | + * @author lin | ||
| 16 | */ | 18 | */ |
| 17 | @RestControllerAdvice | 19 | @RestControllerAdvice |
| 18 | public class GlobalResponseAdvice implements ResponseBodyAdvice<Object> { | 20 | public class GlobalResponseAdvice implements ResponseBodyAdvice<Object> { |
| 19 | 21 | ||
| 20 | 22 | ||
| 21 | @Override | 23 | @Override |
| 22 | - public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) { | 24 | + public boolean supports(@NotNull MethodParameter returnType, @NotNull Class<? extends HttpMessageConverter<?>> converterType) { |
| 23 | return true; | 25 | return true; |
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | @Override | 28 | @Override |
| 27 | - public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) { | 29 | + public Object beforeBodyWrite(Object body, @NotNull MethodParameter returnType, @NotNull MediaType selectedContentType, @NotNull Class<? extends HttpMessageConverter<?>> selectedConverterType, @NotNull ServerHttpRequest request, @NotNull ServerHttpResponse response) { |
| 28 | // 排除api文档的接口,这个接口不需要统一 | 30 | // 排除api文档的接口,这个接口不需要统一 |
| 29 | - String[] excludePath = {"/v3/api-docs","/api/v1"}; | 31 | + String[] excludePath = {"/v3/api-docs","/api/v1","/index/hook"}; |
| 30 | for (String path : excludePath) { | 32 | for (String path : excludePath) { |
| 31 | if (request.getURI().getPath().startsWith(path)) { | 33 | if (request.getURI().getPath().startsWith(path)) { |
| 32 | return body; | 34 | return body; |
| @@ -43,7 +45,7 @@ public class GlobalResponseAdvice implements ResponseBodyAdvice<Object> { | @@ -43,7 +45,7 @@ public class GlobalResponseAdvice implements ResponseBodyAdvice<Object> { | ||
| 43 | } | 45 | } |
| 44 | 46 | ||
| 45 | if (body instanceof String) { | 47 | if (body instanceof String) { |
| 46 | - return JSON.toJSON(WVPResult.success(body)); | 48 | + return JSON.toJSONString(WVPResult.success(body)); |
| 47 | } | 49 | } |
| 48 | 50 | ||
| 49 | return WVPResult.success(body); | 51 | return WVPResult.success(body); |
src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackResult.java
| @@ -4,14 +4,18 @@ import com.alibaba.fastjson.JSONObject; | @@ -4,14 +4,18 @@ import com.alibaba.fastjson.JSONObject; | ||
| 4 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | 4 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 5 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 5 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 6 | 6 | ||
| 7 | -import javax.sip.RequestEvent; | 7 | +import java.util.EventObject; |
| 8 | 8 | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @author lin | ||
| 12 | + */ | ||
| 9 | public class PlayBackResult<T> { | 13 | public class PlayBackResult<T> { |
| 10 | private int code; | 14 | private int code; |
| 11 | private T data; | 15 | private T data; |
| 12 | private MediaServerItem mediaServerItem; | 16 | private MediaServerItem mediaServerItem; |
| 13 | private JSONObject response; | 17 | private JSONObject response; |
| 14 | - private SipSubscribe.EventResult event; | 18 | + private SipSubscribe.EventResult<EventObject> event; |
| 15 | 19 | ||
| 16 | public int getCode() { | 20 | public int getCode() { |
| 17 | return code; | 21 | return code; |
| @@ -45,11 +49,11 @@ public class PlayBackResult<T> { | @@ -45,11 +49,11 @@ public class PlayBackResult<T> { | ||
| 45 | this.response = response; | 49 | this.response = response; |
| 46 | } | 50 | } |
| 47 | 51 | ||
| 48 | - public SipSubscribe.EventResult getEvent() { | 52 | + public SipSubscribe.EventResult<EventObject> getEvent() { |
| 49 | return event; | 53 | return event; |
| 50 | } | 54 | } |
| 51 | 55 | ||
| 52 | - public void setEvent(SipSubscribe.EventResult event) { | 56 | + public void setEvent(SipSubscribe.EventResult<EventObject> event) { |
| 53 | this.event = event; | 57 | this.event = event; |
| 54 | } | 58 | } |
| 55 | } | 59 | } |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -12,8 +12,6 @@ import org.slf4j.Logger; | @@ -12,8 +12,6 @@ import org.slf4j.Logger; | ||
| 12 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.beans.factory.annotation.Qualifier; | 14 | import org.springframework.beans.factory.annotation.Qualifier; |
| 15 | -import org.springframework.http.HttpStatus; | ||
| 16 | -import org.springframework.http.ResponseEntity; | ||
| 17 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | 15 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 18 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
| 19 | import org.springframework.web.context.request.async.DeferredResult; | 17 | import org.springframework.web.context.request.async.DeferredResult; |
| @@ -362,7 +360,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -362,7 +360,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 362 | resultHolder.invokeAllResult(msg); | 360 | resultHolder.invokeAllResult(msg); |
| 363 | } else { | 361 | } else { |
| 364 | logger.warn("设备预览API调用失败!"); | 362 | logger.warn("设备预览API调用失败!"); |
| 365 | - msg.setData("设备预览API调用失败!"); | 363 | + msg.setData(WVPResult.fail(ErrorCode.ERROR100.getCode(), "设备预览API调用失败!")); |
| 366 | resultHolder.invokeAllResult(msg); | 364 | resultHolder.invokeAllResult(msg); |
| 367 | } | 365 | } |
| 368 | } | 366 | } |
| @@ -415,16 +413,15 @@ public class PlayServiceImpl implements IPlayService { | @@ -415,16 +413,15 @@ public class PlayServiceImpl implements IPlayService { | ||
| 415 | } | 413 | } |
| 416 | DeferredResult<String> result = new DeferredResult<>(30000L); | 414 | DeferredResult<String> result = new DeferredResult<>(30000L); |
| 417 | resultHolder.put(DeferredResultHolder.CALLBACK_CMD_PLAYBACK + deviceId + channelId, uuid, result); | 415 | resultHolder.put(DeferredResultHolder.CALLBACK_CMD_PLAYBACK + deviceId + channelId, uuid, result); |
| 418 | - RequestMessage msg = new RequestMessage(); | ||
| 419 | - msg.setId(uuid); | ||
| 420 | - msg.setKey(key); | 416 | + RequestMessage requestMessage = new RequestMessage(); |
| 417 | + requestMessage.setId(uuid); | ||
| 418 | + requestMessage.setKey(key); | ||
| 421 | PlayBackResult<RequestMessage> playBackResult = new PlayBackResult<>(); | 419 | PlayBackResult<RequestMessage> playBackResult = new PlayBackResult<>(); |
| 422 | - String playBackTimeOutTaskKey = UUID.randomUUID().toString(); | 420 | + String playBackTimeOutTaskKey = UUID.randomUUID().toString(); |
| 423 | dynamicTask.startDelay(playBackTimeOutTaskKey, ()->{ | 421 | dynamicTask.startDelay(playBackTimeOutTaskKey, ()->{ |
| 424 | logger.warn(String.format("设备回放超时,deviceId:%s ,channelId:%s", deviceId, channelId)); | 422 | logger.warn(String.format("设备回放超时,deviceId:%s ,channelId:%s", deviceId, channelId)); |
| 425 | playBackResult.setCode(-1); | 423 | playBackResult.setCode(-1); |
| 426 | - playBackResult.setData(msg); | ||
| 427 | - playBackCallback.call(playBackResult); | 424 | + playBackResult.setData(requestMessage); |
| 428 | SIPDialog dialog = streamSession.getDialogByStream(deviceId, channelId, ssrcInfo.getStream()); | 425 | SIPDialog dialog = streamSession.getDialogByStream(deviceId, channelId, ssrcInfo.getStream()); |
| 429 | // 点播超时回复BYE 同时释放ssrc以及此次点播的资源 | 426 | // 点播超时回复BYE 同时释放ssrc以及此次点播的资源 |
| 430 | if (dialog != null) { | 427 | if (dialog != null) { |
| @@ -447,24 +444,23 @@ public class PlayServiceImpl implements IPlayService { | @@ -447,24 +444,23 @@ public class PlayServiceImpl implements IPlayService { | ||
| 447 | StreamInfo streamInfo = onPublishHandler(inviteStreamInfo.getMediaServerItem(), inviteStreamInfo.getResponse(), deviceId, channelId); | 444 | StreamInfo streamInfo = onPublishHandler(inviteStreamInfo.getMediaServerItem(), inviteStreamInfo.getResponse(), deviceId, channelId); |
| 448 | if (streamInfo == null) { | 445 | if (streamInfo == null) { |
| 449 | logger.warn("设备回放API调用失败!"); | 446 | logger.warn("设备回放API调用失败!"); |
| 450 | - msg.setData("设备回放API调用失败!"); | ||
| 451 | playBackResult.setCode(-1); | 447 | playBackResult.setCode(-1); |
| 452 | - playBackResult.setData(msg); | ||
| 453 | playBackCallback.call(playBackResult); | 448 | playBackCallback.call(playBackResult); |
| 454 | return; | 449 | return; |
| 455 | } | 450 | } |
| 456 | redisCatchStorage.startPlayback(streamInfo, inviteStreamInfo.getCallId()); | 451 | redisCatchStorage.startPlayback(streamInfo, inviteStreamInfo.getCallId()); |
| 457 | - msg.setData(JSON.toJSONString(streamInfo)); | 452 | + WVPResult<StreamInfo> success = WVPResult.success(streamInfo); |
| 453 | + requestMessage.setData(success); | ||
| 458 | playBackResult.setCode(0); | 454 | playBackResult.setCode(0); |
| 459 | - playBackResult.setData(msg); | 455 | + playBackResult.setData(requestMessage); |
| 460 | playBackResult.setMediaServerItem(inviteStreamInfo.getMediaServerItem()); | 456 | playBackResult.setMediaServerItem(inviteStreamInfo.getMediaServerItem()); |
| 461 | playBackResult.setResponse(inviteStreamInfo.getResponse()); | 457 | playBackResult.setResponse(inviteStreamInfo.getResponse()); |
| 462 | playBackCallback.call(playBackResult); | 458 | playBackCallback.call(playBackResult); |
| 463 | }, event -> { | 459 | }, event -> { |
| 464 | dynamicTask.stop(playBackTimeOutTaskKey); | 460 | dynamicTask.stop(playBackTimeOutTaskKey); |
| 465 | - msg.setData(String.format("回放失败, 错误码: %s, %s", event.statusCode, event.msg)); | 461 | + requestMessage.setData(WVPResult.fail(ErrorCode.ERROR100.getCode(), String.format("回放失败, 错误码: %s, %s", event.statusCode, event.msg))); |
| 466 | playBackResult.setCode(-1); | 462 | playBackResult.setCode(-1); |
| 467 | - playBackResult.setData(msg); | 463 | + playBackResult.setData(requestMessage); |
| 468 | playBackResult.setEvent(event); | 464 | playBackResult.setEvent(event); |
| 469 | playBackCallback.call(playBackResult); | 465 | playBackCallback.call(playBackResult); |
| 470 | streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); | 466 | streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); |
| @@ -498,13 +494,13 @@ public class PlayServiceImpl implements IPlayService { | @@ -498,13 +494,13 @@ public class PlayServiceImpl implements IPlayService { | ||
| 498 | } | 494 | } |
| 499 | 495 | ||
| 500 | resultHolder.put(key, uuid, result); | 496 | resultHolder.put(key, uuid, result); |
| 501 | - RequestMessage msg = new RequestMessage(); | ||
| 502 | - msg.setId(uuid); | ||
| 503 | - msg.setKey(key); | 497 | + RequestMessage requestMessage = new RequestMessage(); |
| 498 | + requestMessage.setId(uuid); | ||
| 499 | + requestMessage.setKey(key); | ||
| 504 | WVPResult<StreamInfo> wvpResult = new WVPResult<>(); | 500 | WVPResult<StreamInfo> wvpResult = new WVPResult<>(); |
| 505 | - msg.setData(wvpResult); | 501 | + requestMessage.setData(wvpResult); |
| 506 | PlayBackResult<RequestMessage> downloadResult = new PlayBackResult<>(); | 502 | PlayBackResult<RequestMessage> downloadResult = new PlayBackResult<>(); |
| 507 | - downloadResult.setData(msg); | 503 | + downloadResult.setData(requestMessage); |
| 508 | 504 | ||
| 509 | String downLoadTimeOutTaskKey = UUID.randomUUID().toString(); | 505 | String downLoadTimeOutTaskKey = UUID.randomUUID().toString(); |
| 510 | dynamicTask.startDelay(downLoadTimeOutTaskKey, ()->{ | 506 | dynamicTask.startDelay(downLoadTimeOutTaskKey, ()->{ |
| @@ -606,7 +602,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -606,7 +602,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 606 | resultHolder.invokeResult(msg); | 602 | resultHolder.invokeResult(msg); |
| 607 | } else { | 603 | } else { |
| 608 | logger.warn("设备预览API调用失败!"); | 604 | logger.warn("设备预览API调用失败!"); |
| 609 | - msg.setData("设备预览API调用失败!"); | 605 | + msg.setData(WVPResult.fail(ErrorCode.ERROR100.getCode(), "设备预览API调用失败!")); |
| 610 | resultHolder.invokeResult(msg); | 606 | resultHolder.invokeResult(msg); |
| 611 | } | 607 | } |
| 612 | } | 608 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
| @@ -24,8 +24,6 @@ import io.swagger.v3.oas.annotations.tags.Tag; | @@ -24,8 +24,6 @@ import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 24 | import org.slf4j.Logger; | 24 | import org.slf4j.Logger; |
| 25 | import org.slf4j.LoggerFactory; | 25 | import org.slf4j.LoggerFactory; |
| 26 | import org.springframework.beans.factory.annotation.Autowired; | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| 27 | -import org.springframework.http.HttpStatus; | ||
| 28 | -import org.springframework.http.ResponseEntity; | ||
| 29 | import org.springframework.web.bind.annotation.CrossOrigin; | 27 | import org.springframework.web.bind.annotation.CrossOrigin; |
| 30 | import org.springframework.web.bind.annotation.GetMapping; | 28 | import org.springframework.web.bind.annotation.GetMapping; |
| 31 | import org.springframework.web.bind.annotation.PathVariable; | 29 | import org.springframework.web.bind.annotation.PathVariable; |
| @@ -80,7 +78,7 @@ public class PlayController { | @@ -80,7 +78,7 @@ public class PlayController { | ||
| 80 | @Parameter(name = "deviceId", description = "设备国标编号", required = true) | 78 | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| 81 | @Parameter(name = "channelId", description = "通道国标编号", required = true) | 79 | @Parameter(name = "channelId", description = "通道国标编号", required = true) |
| 82 | @GetMapping("/start/{deviceId}/{channelId}") | 80 | @GetMapping("/start/{deviceId}/{channelId}") |
| 83 | - public DeferredResult<String> play(@PathVariable String deviceId, | 81 | + public DeferredResult<WVPResult<String>> play(@PathVariable String deviceId, |
| 84 | @PathVariable String channelId) { | 82 | @PathVariable String channelId) { |
| 85 | 83 | ||
| 86 | // 获取可用的zlm | 84 | // 获取可用的zlm |
| @@ -96,72 +94,33 @@ public class PlayController { | @@ -96,72 +94,33 @@ public class PlayController { | ||
| 96 | @Parameter(name = "deviceId", description = "设备国标编号", required = true) | 94 | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| 97 | @Parameter(name = "channelId", description = "通道国标编号", required = true) | 95 | @Parameter(name = "channelId", description = "通道国标编号", required = true) |
| 98 | @GetMapping("/stop/{deviceId}/{channelId}") | 96 | @GetMapping("/stop/{deviceId}/{channelId}") |
| 99 | - public DeferredResult<String> playStop(@PathVariable String deviceId, @PathVariable String channelId) { | 97 | + public JSONObject playStop(@PathVariable String deviceId, @PathVariable String channelId) { |
| 100 | 98 | ||
| 101 | logger.debug(String.format("设备预览/回放停止API调用,streamId:%s_%s", deviceId, channelId )); | 99 | logger.debug(String.format("设备预览/回放停止API调用,streamId:%s_%s", deviceId, channelId )); |
| 102 | 100 | ||
| 103 | - String uuid = UUID.randomUUID().toString(); | ||
| 104 | - DeferredResult<String> result = new DeferredResult<>(); | 101 | + if (deviceId == null || channelId == null) { |
| 102 | + throw new ControllerException(ErrorCode.ERROR400); | ||
| 103 | + } | ||
| 105 | 104 | ||
| 106 | - // 录像查询以channelId作为deviceId查询 | ||
| 107 | - String key = DeferredResultHolder.CALLBACK_CMD_STOP + deviceId + channelId; | ||
| 108 | - resultHolder.put(key, uuid, result); | ||
| 109 | StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId); | 105 | StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId); |
| 110 | if (streamInfo == null) { | 106 | if (streamInfo == null) { |
| 111 | - RequestMessage msg = new RequestMessage(); | ||
| 112 | - msg.setId(uuid); | ||
| 113 | - msg.setKey(key); | ||
| 114 | - msg.setData("点播未找到"); | ||
| 115 | - resultHolder.invokeAllResult(msg); | ||
| 116 | - storager.stopPlay(deviceId, channelId); | ||
| 117 | - return result; | 107 | + throw new ControllerException(ErrorCode.ERROR100.getCode(), "点播未找到"); |
| 118 | } | 108 | } |
| 119 | - cmder.streamByeCmd(deviceId, channelId, streamInfo.getStream(), null, eventResult -> { | ||
| 120 | - redisCatchStorage.stopPlay(streamInfo); | ||
| 121 | - storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); | ||
| 122 | - RequestMessage msgForSuccess = new RequestMessage(); | ||
| 123 | - msgForSuccess.setId(uuid); | ||
| 124 | - msgForSuccess.setKey(key); | ||
| 125 | - msgForSuccess.setData(String.format("success")); | ||
| 126 | - resultHolder.invokeAllResult(msgForSuccess); | ||
| 127 | - }); | ||
| 128 | 109 | ||
| 129 | - if (deviceId != null || channelId != null) { | ||
| 130 | - JSONObject json = new JSONObject(); | ||
| 131 | - json.put("deviceId", deviceId); | ||
| 132 | - json.put("channelId", channelId); | ||
| 133 | - RequestMessage msg = new RequestMessage(); | ||
| 134 | - msg.setId(uuid); | ||
| 135 | - msg.setKey(key); | ||
| 136 | - msg.setData(json.toString()); | ||
| 137 | - resultHolder.invokeAllResult(msg); | ||
| 138 | - } else { | ||
| 139 | - logger.warn("设备预览/回放停止API调用失败!"); | ||
| 140 | - RequestMessage msg = new RequestMessage(); | ||
| 141 | - msg.setId(uuid); | ||
| 142 | - msg.setKey(key); | ||
| 143 | - msg.setData("streamId null"); | ||
| 144 | - resultHolder.invokeAllResult(msg); | ||
| 145 | - } | 110 | + cmder.streamByeCmd(deviceId, channelId, streamInfo.getStream(), null, null); |
| 111 | + redisCatchStorage.stopPlay(streamInfo); | ||
| 112 | + | ||
| 113 | + storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); | ||
| 114 | + JSONObject json = new JSONObject(); | ||
| 115 | + json.put("deviceId", deviceId); | ||
| 116 | + json.put("channelId", channelId); | ||
| 117 | + return json; | ||
| 146 | 118 | ||
| 147 | - // 超时处理 | ||
| 148 | - result.onTimeout(()->{ | ||
| 149 | - logger.warn(String.format("设备预览/回放停止超时,deviceId/channelId:%s_%s ", deviceId, channelId)); | ||
| 150 | - redisCatchStorage.stopPlay(streamInfo); | ||
| 151 | - storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); | ||
| 152 | - RequestMessage msg = new RequestMessage(); | ||
| 153 | - msg.setId(uuid); | ||
| 154 | - msg.setKey(key); | ||
| 155 | - msg.setData("Timeout"); | ||
| 156 | - resultHolder.invokeAllResult(msg); | ||
| 157 | - }); | ||
| 158 | - return result; | ||
| 159 | } | 119 | } |
| 160 | 120 | ||
| 161 | /** | 121 | /** |
| 162 | * 将不是h264的视频通过ffmpeg 转码为h264 + aac | 122 | * 将不是h264的视频通过ffmpeg 转码为h264 + aac |
| 163 | * @param streamId 流ID | 123 | * @param streamId 流ID |
| 164 | - * @return | ||
| 165 | */ | 124 | */ |
| 166 | @Operation(summary = "将不是h264的视频通过ffmpeg 转码为h264 + aac") | 125 | @Operation(summary = "将不是h264的视频通过ffmpeg 转码为h264 + aac") |
| 167 | @Parameter(name = "streamId", description = "视频流ID", required = true) | 126 | @Parameter(name = "streamId", description = "视频流ID", required = true) |
| @@ -205,8 +164,6 @@ public class PlayController { | @@ -205,8 +164,6 @@ public class PlayController { | ||
| 205 | 164 | ||
| 206 | /** | 165 | /** |
| 207 | * 结束转码 | 166 | * 结束转码 |
| 208 | - * @param key | ||
| 209 | - * @return | ||
| 210 | */ | 167 | */ |
| 211 | @Operation(summary = "结束转码") | 168 | @Operation(summary = "结束转码") |
| 212 | @Parameter(name = "key", description = "视频流key", required = true) | 169 | @Parameter(name = "key", description = "视频流key", required = true) |
| @@ -278,7 +235,7 @@ public class PlayController { | @@ -278,7 +235,7 @@ public class PlayController { | ||
| 278 | }); | 235 | }); |
| 279 | 236 | ||
| 280 | result.onTimeout(() -> { | 237 | result.onTimeout(() -> { |
| 281 | - logger.warn(String.format("语音广播操作超时, 设备未返回应答指令")); | 238 | + logger.warn("语音广播操作超时, 设备未返回应答指令"); |
| 282 | RequestMessage msg = new RequestMessage(); | 239 | RequestMessage msg = new RequestMessage(); |
| 283 | msg.setKey(key); | 240 | msg.setKey(key); |
| 284 | msg.setId(uuid); | 241 | msg.setId(uuid); |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
| @@ -3,7 +3,6 @@ package com.genersoft.iot.vmp.vmanager.gb28181.playback; | @@ -3,7 +3,6 @@ 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.service.IMediaServerService; | ||
| 7 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 6 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 8 | import com.genersoft.iot.vmp.service.IPlayService; | 7 | import com.genersoft.iot.vmp.service.IPlayService; |
| 9 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; | 8 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| @@ -13,10 +12,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; | @@ -13,10 +12,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 13 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
| 14 | import org.slf4j.LoggerFactory; | 13 | import org.slf4j.LoggerFactory; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | -import org.springframework.http.HttpStatus; | ||
| 17 | -import org.springframework.http.ResponseEntity; | ||
| 18 | import org.springframework.util.ObjectUtils; | 15 | import org.springframework.util.ObjectUtils; |
| 19 | -import org.springframework.util.StringUtils; | ||
| 20 | import org.springframework.web.bind.annotation.CrossOrigin; | 16 | import org.springframework.web.bind.annotation.CrossOrigin; |
| 21 | import org.springframework.web.bind.annotation.GetMapping; | 17 | import org.springframework.web.bind.annotation.GetMapping; |
| 22 | import org.springframework.web.bind.annotation.PathVariable; | 18 | import org.springframework.web.bind.annotation.PathVariable; |
| @@ -29,6 +25,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | @@ -29,6 +25,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | ||
| 29 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 25 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 30 | import org.springframework.web.context.request.async.DeferredResult; | 26 | import org.springframework.web.context.request.async.DeferredResult; |
| 31 | 27 | ||
| 28 | +/** | ||
| 29 | + * @author lin | ||
| 30 | + */ | ||
| 32 | @Tag(name = "视频回放") | 31 | @Tag(name = "视频回放") |
| 33 | @CrossOrigin | 32 | @CrossOrigin |
| 34 | @RestController | 33 | @RestController |
| @@ -65,11 +64,9 @@ public class PlaybackController { | @@ -65,11 +64,9 @@ public class PlaybackController { | ||
| 65 | logger.debug(String.format("设备回放 API调用,deviceId:%s ,channelId:%s", deviceId, channelId)); | 64 | logger.debug(String.format("设备回放 API调用,deviceId:%s ,channelId:%s", deviceId, channelId)); |
| 66 | } | 65 | } |
| 67 | 66 | ||
| 68 | - DeferredResult<String> result = playService.playBack(deviceId, channelId, startTime, endTime, null, wvpResult->{ | ||
| 69 | - resultHolder.invokeResult(wvpResult.getData()); | ||
| 70 | - }); | ||
| 71 | 67 | ||
| 72 | - return result; | 68 | + return playService.playBack(deviceId, channelId, startTime, endTime, null, |
| 69 | + playBackResult->resultHolder.invokeResult(playBackResult.getData())); | ||
| 73 | } | 70 | } |
| 74 | 71 | ||
| 75 | 72 | ||
| @@ -109,10 +106,8 @@ public class PlaybackController { | @@ -109,10 +106,8 @@ public class PlaybackController { | ||
| 109 | @GetMapping("/resume/{streamId}") | 106 | @GetMapping("/resume/{streamId}") |
| 110 | public void playResume(@PathVariable String streamId) { | 107 | public void playResume(@PathVariable String streamId) { |
| 111 | logger.info("playResume: "+streamId); | 108 | logger.info("playResume: "+streamId); |
| 112 | - JSONObject json = new JSONObject(); | ||
| 113 | StreamInfo streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null); | 109 | StreamInfo streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null); |
| 114 | if (null == streamInfo) { | 110 | if (null == streamInfo) { |
| 115 | - json.put("msg", "streamId不存在"); | ||
| 116 | logger.warn("streamId不存在!"); | 111 | logger.warn("streamId不存在!"); |
| 117 | throw new ControllerException(ErrorCode.ERROR400.getCode(), "streamId不存在"); | 112 | throw new ControllerException(ErrorCode.ERROR400.getCode(), "streamId不存在"); |
| 118 | } | 113 | } |
web_src/src/components/CloudRecordDetail.vue
| @@ -15,7 +15,6 @@ | @@ -15,7 +15,6 @@ | ||
| 15 | <i class="el-icon-video-camera" ></i> | 15 | <i class="el-icon-video-camera" ></i> |
| 16 | {{ item.substring(0,17)}} | 16 | {{ item.substring(0,17)}} |
| 17 | </el-tag> | 17 | </el-tag> |
| 18 | -<!-- <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" :href="`${basePath}/${mediaServerId}/record/${recordFile.app}/${recordFile.stream}/${chooseDate}/${item}`" download />--> | ||
| 19 | <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" :href="`${basePath}/download.html?url=record/${recordFile.app}/${recordFile.stream}/${chooseDate}/${item}`" target="_blank" /> | 18 | <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" :href="`${basePath}/download.html?url=record/${recordFile.app}/${recordFile.stream}/${chooseDate}/${item}`" target="_blank" /> |
| 20 | </li> | 19 | </li> |
| 21 | </ul> | 20 | </ul> |
| @@ -392,7 +391,7 @@ | @@ -392,7 +391,7 @@ | ||
| 392 | endTime: moment(this.taskTimeRange[1]).format('YYYY-MM-DD HH:mm:ss'), | 391 | endTime: moment(this.taskTimeRange[1]).format('YYYY-MM-DD HH:mm:ss'), |
| 393 | } | 392 | } |
| 394 | }).then(function (res) { | 393 | }).then(function (res) { |
| 395 | - if (res.data.code === 0 && res.data.msg === "success") { | 394 | + if (res.data.code === 0 ) { |
| 396 | that.showTaskBox = false | 395 | that.showTaskBox = false |
| 397 | that.getTaskList(false); | 396 | that.getTaskList(false); |
| 398 | }else { | 397 | }else { |
| @@ -414,7 +413,7 @@ | @@ -414,7 +413,7 @@ | ||
| 414 | isEnd: isEnd, | 413 | isEnd: isEnd, |
| 415 | } | 414 | } |
| 416 | }).then(function (res) { | 415 | }).then(function (res) { |
| 417 | - if (res.data.code == 0) { | 416 | + if (res.data.code === 0) { |
| 418 | if (isEnd){ | 417 | if (isEnd){ |
| 419 | that.taskListEnded = res.data.data; | 418 | that.taskListEnded = res.data.data; |
| 420 | }else { | 419 | }else { |
web_src/src/components/ParentPlatformList.vue
| @@ -127,8 +127,8 @@ export default { | @@ -127,8 +127,8 @@ export default { | ||
| 127 | deletePlatformCommit: function(platform) { | 127 | deletePlatformCommit: function(platform) { |
| 128 | var that = this; | 128 | var that = this; |
| 129 | that.$axios({ | 129 | that.$axios({ |
| 130 | - method: 'delete', | ||
| 131 | - url:`/api/platform/delete/${platform.serverGBId}` | 130 | + method: 'delete', |
| 131 | + url:`/api/platform/delete/${platform.serverGBId}` | ||
| 132 | }).then(function (res) { | 132 | }).then(function (res) { |
| 133 | if (res.data.code === 0) { | 133 | if (res.data.code === 0) { |
| 134 | that.$message({ | 134 | that.$message({ |
web_src/src/components/PushVideoList.vue
| @@ -229,7 +229,7 @@ export default { | @@ -229,7 +229,7 @@ export default { | ||
| 229 | streamId: row.stream | 229 | streamId: row.stream |
| 230 | } | 230 | } |
| 231 | }).then((res) => { | 231 | }).then((res) => { |
| 232 | - if (res.data == "success") { | 232 | + if (res.data.code === 0) { |
| 233 | that.initData() | 233 | that.initData() |
| 234 | } | 234 | } |
| 235 | }).catch(function (error) { | 235 | }).catch(function (error) { |
| @@ -250,7 +250,7 @@ export default { | @@ -250,7 +250,7 @@ export default { | ||
| 250 | url: "/api/push/remove_form_gb", | 250 | url: "/api/push/remove_form_gb", |
| 251 | data: row | 251 | data: row |
| 252 | }).then((res) => { | 252 | }).then((res) => { |
| 253 | - if (res.data == "success") { | 253 | + if (res.data.code === 0) { |
| 254 | that.initData() | 254 | that.initData() |
| 255 | } | 255 | } |
| 256 | }).catch(function (error) { | 256 | }).catch(function (error) { |
web_src/src/components/StreamProxyList.vue
| @@ -168,12 +168,14 @@ | @@ -168,12 +168,14 @@ | ||
| 168 | count: that.count | 168 | count: that.count |
| 169 | } | 169 | } |
| 170 | }).then(function (res) { | 170 | }).then(function (res) { |
| 171 | - that.total = res.data.total; | ||
| 172 | - for (let i = 0; i < res.data.list.length; i++) { | ||
| 173 | - res.data.list[i]["startBtnLoading"] = false; | 171 | + if (res.data.code === 0) { |
| 172 | + that.total = res.data.data.total; | ||
| 173 | + for (let i = 0; i < res.data.data.list.length; i++) { | ||
| 174 | + res.data.data.list[i]["startBtnLoading"] = false; | ||
| 175 | + } | ||
| 176 | + that.streamProxyList = res.data.data.list; | ||
| 174 | } | 177 | } |
| 175 | - that.streamProxyList = res.data.list; | ||
| 176 | - that.getListLoading = false; | 178 | + that.getListLoading = false; |
| 177 | }).catch(function (error) { | 179 | }).catch(function (error) { |
| 178 | console.log(error); | 180 | console.log(error); |
| 179 | that.getListLoading = false; | 181 | that.getListLoading = false; |
| @@ -190,7 +192,7 @@ | @@ -190,7 +192,7 @@ | ||
| 190 | url:`/api/onvif/search?timeout=3000`, | 192 | url:`/api/onvif/search?timeout=3000`, |
| 191 | }).then((res) =>{ | 193 | }).then((res) =>{ |
| 192 | this.getListLoading = false; | 194 | this.getListLoading = false; |
| 193 | - if (res.data.code == 0 ){ | 195 | + if (res.data.code === 0 ){ |
| 194 | if (res.data.data.length > 0) { | 196 | if (res.data.data.length > 0) { |
| 195 | this.$refs.onvifEdit.openDialog(res.data.data, (url)=>{ | 197 | this.$refs.onvifEdit.openDialog(res.data.data, (url)=>{ |
| 196 | if (url != null) { | 198 | if (url != null) { |
| @@ -277,7 +279,7 @@ | @@ -277,7 +279,7 @@ | ||
| 277 | }).then(function (res) { | 279 | }).then(function (res) { |
| 278 | that.getListLoading = false; | 280 | that.getListLoading = false; |
| 279 | that.$set(row, 'startBtnLoading', false) | 281 | that.$set(row, 'startBtnLoading', false) |
| 280 | - if (res.data == "success"){ | 282 | + if (res.data.code === 0){ |
| 281 | that.initData() | 283 | that.initData() |
| 282 | }else { | 284 | }else { |
| 283 | that.$message({ | 285 | that.$message({ |
web_src/src/components/UserManager.vue
| @@ -105,8 +105,10 @@ export default { | @@ -105,8 +105,10 @@ export default { | ||
| 105 | count: that.count | 105 | count: that.count |
| 106 | } | 106 | } |
| 107 | }).then(function (res) { | 107 | }).then(function (res) { |
| 108 | - that.total = res.data.total; | ||
| 109 | - that.userList = res.data.list; | 108 | + if (res.data.code === 0) { |
| 109 | + that.total = res.data.data.total; | ||
| 110 | + that.userList = res.data.data.list; | ||
| 111 | + } | ||
| 110 | that.getUserListLoading = false; | 112 | that.getUserListLoading = false; |
| 111 | }).catch(function (error) { | 113 | }).catch(function (error) { |
| 112 | that.getUserListLoading = false; | 114 | that.getUserListLoading = false; |
web_src/src/components/channelList.vue
| @@ -342,12 +342,15 @@ export default { | @@ -342,12 +342,15 @@ export default { | ||
| 342 | channelType: this.channelType | 342 | channelType: this.channelType |
| 343 | } | 343 | } |
| 344 | }).then( (res) =>{ | 344 | }).then( (res) =>{ |
| 345 | - this.total = res.data.total; | ||
| 346 | - this.deviceChannelList = res.data.list; | ||
| 347 | - // 防止出现表格错位 | ||
| 348 | - this.$nextTick(() => { | ||
| 349 | - this.$refs.channelListTable.doLayout(); | ||
| 350 | - }) | 345 | + if (res.data.code === 0) { |
| 346 | + this.total = res.data.data.total; | ||
| 347 | + this.deviceChannelList = res.data.data.list; | ||
| 348 | + // 防止出现表格错位 | ||
| 349 | + this.$nextTick(() => { | ||
| 350 | + this.$refs.channelListTable.doLayout(); | ||
| 351 | + }) | ||
| 352 | + } | ||
| 353 | + | ||
| 351 | }).catch(function (error) { | 354 | }).catch(function (error) { |
| 352 | console.log(error); | 355 | console.log(error); |
| 353 | }); | 356 | }); |
| @@ -361,12 +364,14 @@ export default { | @@ -361,12 +364,14 @@ export default { | ||
| 361 | count: this.count, | 364 | count: this.count, |
| 362 | } | 365 | } |
| 363 | }).then((res)=> { | 366 | }).then((res)=> { |
| 364 | - this.total = res.data.total; | ||
| 365 | - this.deviceChannelList = res.data.list; | ||
| 366 | - // 防止出现表格错位 | ||
| 367 | - this.$nextTick(() => { | ||
| 368 | - this.$refs.channelListTable.doLayout(); | ||
| 369 | - }) | 367 | + if (res.data.code === 0) { |
| 368 | + this.total = res.data.total; | ||
| 369 | + this.deviceChannelList = res.data.list; | ||
| 370 | + // 防止出现表格错位 | ||
| 371 | + this.$nextTick(() => { | ||
| 372 | + this.$refs.channelListTable.doLayout(); | ||
| 373 | + }) | ||
| 374 | + } | ||
| 370 | }).catch(function (error) { | 375 | }).catch(function (error) { |
| 371 | console.log(error); | 376 | console.log(error); |
| 372 | }); | 377 | }); |
web_src/src/components/common/ h265web.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div ref="container" @dblclick="fullscreenSwich" style="width:100%;height:100%;background-color: #000000;margin:0 auto;"> | ||
| 3 | + <div class="buttons-box" id="buttonsBox"> | ||
| 4 | + <div class="buttons-box-left"> | ||
| 5 | + <i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i> | ||
| 6 | + <i v-if="playing" class="iconfont icon-pause jessibuca-btn" @click="pause"></i> | ||
| 7 | + <i class="iconfont icon-stop jessibuca-btn" @click="destroy"></i> | ||
| 8 | + <i v-if="isNotMute" class="iconfont icon-audio-high jessibuca-btn" @click="mute()"></i> | ||
| 9 | + <i v-if="!isNotMute" class="iconfont icon-audio-mute jessibuca-btn" @click="cancelMute()"></i> | ||
| 10 | + </div> | ||
| 11 | + <div class="buttons-box-right"> | ||
| 12 | + <span class="jessibuca-btn">{{ kBps }} kb/s</span> | ||
| 13 | + <!-- <i class="iconfont icon-file-record1 jessibuca-btn"></i>--> | ||
| 14 | + <!-- <i class="iconfont icon-xiangqing2 jessibuca-btn" ></i>--> | ||
| 15 | + <i class="iconfont icon-camera1196054easyiconnet jessibuca-btn" @click="jessibuca.screenshot('截图','png',0.5)" | ||
| 16 | + style="font-size: 1rem !important"></i> | ||
| 17 | + <i class="iconfont icon-shuaxin11 jessibuca-btn" @click="playBtnClick"></i> | ||
| 18 | + <i v-if="!fullscreen" class="iconfont icon-weibiaoti10 jessibuca-btn" @click="fullscreenSwich"></i> | ||
| 19 | + <i v-if="fullscreen" class="iconfont icon-weibiaoti11 jessibuca-btn" @click="fullscreenSwich"></i> | ||
| 20 | + </div> | ||
| 21 | + </div> | ||
| 22 | + </div> | ||
| 23 | +</template> | ||
| 24 | + | ||
| 25 | +<script> | ||
| 26 | +let jessibucaPlayer = {}; | ||
| 27 | +export default { | ||
| 28 | + name: 'jessibuca', | ||
| 29 | + data() { | ||
| 30 | + return { | ||
| 31 | + playing: false, | ||
| 32 | + isNotMute: false, | ||
| 33 | + quieting: false, | ||
| 34 | + fullscreen: false, | ||
| 35 | + loaded: false, // mute | ||
| 36 | + speed: 0, | ||
| 37 | + performance: "", // 工作情况 | ||
| 38 | + kBps: 0, | ||
| 39 | + btnDom: null, | ||
| 40 | + videoInfo: null, | ||
| 41 | + volume: 1, | ||
| 42 | + rotate: 0, | ||
| 43 | + vod: true, // 点播 | ||
| 44 | + forceNoOffscreen: false, | ||
| 45 | + }; | ||
| 46 | + }, | ||
| 47 | + props: ['videoUrl', 'error', 'hasAudio', 'height'], | ||
| 48 | + mounted() { | ||
| 49 | + window.onerror = (msg) => { | ||
| 50 | + // console.error(msg) | ||
| 51 | + }; | ||
| 52 | + console.log(this._uid) | ||
| 53 | + let paramUrl = decodeURIComponent(this.$route.params.url) | ||
| 54 | + this.$nextTick(() => { | ||
| 55 | + this.updatePlayerDomSize() | ||
| 56 | + window.onresize = () => { | ||
| 57 | + this.updatePlayerDomSize() | ||
| 58 | + } | ||
| 59 | + if (typeof (this.videoUrl) == "undefined") { | ||
| 60 | + this.videoUrl = paramUrl; | ||
| 61 | + } | ||
| 62 | + this.btnDom = document.getElementById("buttonsBox"); | ||
| 63 | + console.log("初始化时的地址为: " + this.videoUrl) | ||
| 64 | + this.play(this.videoUrl) | ||
| 65 | + }) | ||
| 66 | + }, | ||
| 67 | + watch: { | ||
| 68 | + videoUrl(newData, oldData) { | ||
| 69 | + this.play(newData) | ||
| 70 | + }, | ||
| 71 | + immediate: true | ||
| 72 | + }, | ||
| 73 | + methods: { | ||
| 74 | + updatePlayerDomSize() { | ||
| 75 | + let dom = this.$refs.container; | ||
| 76 | + let width = dom.parentNode.clientWidth | ||
| 77 | + let height = (9 / 16) * width | ||
| 78 | + | ||
| 79 | + const clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight) | ||
| 80 | + if (height > clientHeight) { | ||
| 81 | + height = clientHeight | ||
| 82 | + width = (16 / 9) * height | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + dom.style.width = width + 'px'; | ||
| 86 | + dom.style.height = height + "px"; | ||
| 87 | + }, | ||
| 88 | + create() { | ||
| 89 | + let options = {}; | ||
| 90 | + console.log("hasAudio " + this.hasAudio) | ||
| 91 | + | ||
| 92 | + jessibucaPlayer[this._uid] = new window.Jessibuca(Object.assign( | ||
| 93 | + { | ||
| 94 | + container: this.$refs.container, | ||
| 95 | + videoBuffer: 0.2, // 最大缓冲时长,单位秒 | ||
| 96 | + isResize: true, | ||
| 97 | + decoder: "static/js/jessibuca/decoder.js", | ||
| 98 | + useMSE: false, | ||
| 99 | + showBandwidth: false, | ||
| 100 | + isFlv: true, | ||
| 101 | + // text: "WVP-PRO", | ||
| 102 | + // background: "static/images/zlm-logo.png", | ||
| 103 | + loadingText: "加载中", | ||
| 104 | + hasAudio: typeof (this.hasAudio) == "undefined" ? true : this.hasAudio, | ||
| 105 | + debug: false, | ||
| 106 | + supportDblclickFullscreen: false, // 是否支持屏幕的双击事件,触发全屏,取消全屏事件。 | ||
| 107 | + operateBtns: { | ||
| 108 | + fullscreen: false, | ||
| 109 | + screenshot: false, | ||
| 110 | + play: false, | ||
| 111 | + audio: false, | ||
| 112 | + recorder: false, | ||
| 113 | + }, | ||
| 114 | + record: "record", | ||
| 115 | + vod: this.vod, | ||
| 116 | + forceNoOffscreen: this.forceNoOffscreen, | ||
| 117 | + isNotMute: this.isNotMute, | ||
| 118 | + }, | ||
| 119 | + options | ||
| 120 | + )); | ||
| 121 | + let jessibuca = jessibucaPlayer[this._uid]; | ||
| 122 | + let _this = this; | ||
| 123 | + jessibuca.on("load", function () { | ||
| 124 | + console.log("on load init"); | ||
| 125 | + }); | ||
| 126 | + | ||
| 127 | + jessibuca.on("log", function (msg) { | ||
| 128 | + console.log("on log", msg); | ||
| 129 | + }); | ||
| 130 | + jessibuca.on("record", function (msg) { | ||
| 131 | + console.log("on record:", msg); | ||
| 132 | + }); | ||
| 133 | + jessibuca.on("pause", function () { | ||
| 134 | + _this.playing = false; | ||
| 135 | + }); | ||
| 136 | + jessibuca.on("play", function () { | ||
| 137 | + _this.playing = true; | ||
| 138 | + }); | ||
| 139 | + jessibuca.on("fullscreen", function (msg) { | ||
| 140 | + console.log("on fullscreen", msg); | ||
| 141 | + _this.fullscreen = msg | ||
| 142 | + }); | ||
| 143 | + | ||
| 144 | + jessibuca.on("mute", function (msg) { | ||
| 145 | + console.log("on mute", msg); | ||
| 146 | + _this.isNotMute = !msg; | ||
| 147 | + }); | ||
| 148 | + jessibuca.on("audioInfo", function (msg) { | ||
| 149 | + // console.log("audioInfo", msg); | ||
| 150 | + }); | ||
| 151 | + | ||
| 152 | + jessibuca.on("videoInfo", function (msg) { | ||
| 153 | + // this.videoInfo = msg; | ||
| 154 | + console.log("videoInfo", msg); | ||
| 155 | + | ||
| 156 | + }); | ||
| 157 | + | ||
| 158 | + jessibuca.on("bps", function (bps) { | ||
| 159 | + // console.log('bps', bps); | ||
| 160 | + | ||
| 161 | + }); | ||
| 162 | + let _ts = 0; | ||
| 163 | + jessibuca.on("timeUpdate", function (ts) { | ||
| 164 | + // console.log('timeUpdate,old,new,timestamp', _ts, ts, ts - _ts); | ||
| 165 | + _ts = ts; | ||
| 166 | + }); | ||
| 167 | + | ||
| 168 | + jessibuca.on("videoInfo", function (info) { | ||
| 169 | + console.log("videoInfo", info); | ||
| 170 | + }); | ||
| 171 | + | ||
| 172 | + jessibuca.on("error", function (error) { | ||
| 173 | + console.log("error", error); | ||
| 174 | + }); | ||
| 175 | + | ||
| 176 | + jessibuca.on("timeout", function () { | ||
| 177 | + console.log("timeout"); | ||
| 178 | + }); | ||
| 179 | + | ||
| 180 | + jessibuca.on('start', function () { | ||
| 181 | + console.log('start'); | ||
| 182 | + }) | ||
| 183 | + | ||
| 184 | + jessibuca.on("performance", function (performance) { | ||
| 185 | + let show = "卡顿"; | ||
| 186 | + if (performance === 2) { | ||
| 187 | + show = "非常流畅"; | ||
| 188 | + } else if (performance === 1) { | ||
| 189 | + show = "流畅"; | ||
| 190 | + } | ||
| 191 | + _this.performance = show; | ||
| 192 | + }); | ||
| 193 | + jessibuca.on('buffer', function (buffer) { | ||
| 194 | + // console.log('buffer', buffer); | ||
| 195 | + }) | ||
| 196 | + | ||
| 197 | + jessibuca.on('stats', function (stats) { | ||
| 198 | + // console.log('stats', stats); | ||
| 199 | + }) | ||
| 200 | + | ||
| 201 | + jessibuca.on('kBps', function (kBps) { | ||
| 202 | + _this.kBps = Math.round(kBps); | ||
| 203 | + }); | ||
| 204 | + | ||
| 205 | + // 显示时间戳 PTS | ||
| 206 | + jessibuca.on('videoFrame', function () { | ||
| 207 | + | ||
| 208 | + }) | ||
| 209 | + | ||
| 210 | + // | ||
| 211 | + jessibuca.on('metadata', function () { | ||
| 212 | + | ||
| 213 | + }); | ||
| 214 | + }, | ||
| 215 | + playBtnClick: function (event) { | ||
| 216 | + this.play(this.videoUrl) | ||
| 217 | + }, | ||
| 218 | + play: function (url) { | ||
| 219 | + console.log(url) | ||
| 220 | + if (jessibucaPlayer[this._uid]) { | ||
| 221 | + this.destroy(); | ||
| 222 | + } | ||
| 223 | + this.create(); | ||
| 224 | + jessibucaPlayer[this._uid].on("play", () => { | ||
| 225 | + this.playing = true; | ||
| 226 | + this.loaded = true; | ||
| 227 | + this.quieting = jessibuca.quieting; | ||
| 228 | + }); | ||
| 229 | + if (jessibucaPlayer[this._uid].hasLoaded()) { | ||
| 230 | + jessibucaPlayer[this._uid].play(url); | ||
| 231 | + } else { | ||
| 232 | + jessibucaPlayer[this._uid].on("load", () => { | ||
| 233 | + console.log("load 播放") | ||
| 234 | + jessibucaPlayer[this._uid].play(url); | ||
| 235 | + }); | ||
| 236 | + } | ||
| 237 | + }, | ||
| 238 | + pause: function () { | ||
| 239 | + if (jessibucaPlayer[this._uid]) { | ||
| 240 | + jessibucaPlayer[this._uid].pause(); | ||
| 241 | + } | ||
| 242 | + this.playing = false; | ||
| 243 | + this.err = ""; | ||
| 244 | + this.performance = ""; | ||
| 245 | + }, | ||
| 246 | + mute: function () { | ||
| 247 | + if (jessibucaPlayer[this._uid]) { | ||
| 248 | + jessibucaPlayer[this._uid].mute(); | ||
| 249 | + } | ||
| 250 | + }, | ||
| 251 | + cancelMute: function () { | ||
| 252 | + if (jessibucaPlayer[this._uid]) { | ||
| 253 | + jessibucaPlayer[this._uid].cancelMute(); | ||
| 254 | + } | ||
| 255 | + }, | ||
| 256 | + destroy: function () { | ||
| 257 | + if (jessibucaPlayer[this._uid]) { | ||
| 258 | + jessibucaPlayer[this._uid].destroy(); | ||
| 259 | + } | ||
| 260 | + if (document.getElementById("buttonsBox") == null) { | ||
| 261 | + this.$refs.container.appendChild(this.btnDom) | ||
| 262 | + } | ||
| 263 | + jessibucaPlayer[this._uid] = null; | ||
| 264 | + this.playing = false; | ||
| 265 | + this.err = ""; | ||
| 266 | + this.performance = ""; | ||
| 267 | + | ||
| 268 | + }, | ||
| 269 | + eventcallbacK: function (type, message) { | ||
| 270 | + // console.log("player 事件回调") | ||
| 271 | + // console.log(type) | ||
| 272 | + // console.log(message) | ||
| 273 | + }, | ||
| 274 | + fullscreenSwich: function () { | ||
| 275 | + let isFull = this.isFullscreen() | ||
| 276 | + jessibucaPlayer[this._uid].setFullscreen(!isFull) | ||
| 277 | + this.fullscreen = !isFull; | ||
| 278 | + }, | ||
| 279 | + isFullscreen: function () { | ||
| 280 | + return document.fullscreenElement || | ||
| 281 | + document.msFullscreenElement || | ||
| 282 | + document.mozFullScreenElement || | ||
| 283 | + document.webkitFullscreenElement || false; | ||
| 284 | + } | ||
| 285 | + }, | ||
| 286 | + destroyed() { | ||
| 287 | + if (jessibucaPlayer[this._uid]) { | ||
| 288 | + jessibucaPlayer[this._uid].destroy(); | ||
| 289 | + } | ||
| 290 | + this.playing = false; | ||
| 291 | + this.loaded = false; | ||
| 292 | + this.performance = ""; | ||
| 293 | + }, | ||
| 294 | +} | ||
| 295 | +</script> | ||
| 296 | + | ||
| 297 | +<style> | ||
| 298 | +.buttons-box { | ||
| 299 | + width: 100%; | ||
| 300 | + height: 28px; | ||
| 301 | + background-color: rgba(43, 51, 63, 0.7); | ||
| 302 | + position: absolute; | ||
| 303 | + display: -webkit-box; | ||
| 304 | + display: -ms-flexbox; | ||
| 305 | + display: flex; | ||
| 306 | + left: 0; | ||
| 307 | + bottom: 0; | ||
| 308 | + user-select: none; | ||
| 309 | + z-index: 10; | ||
| 310 | +} | ||
| 311 | + | ||
| 312 | +.jessibuca-btn { | ||
| 313 | + width: 20px; | ||
| 314 | + color: rgb(255, 255, 255); | ||
| 315 | + line-height: 27px; | ||
| 316 | + margin: 0px 10px; | ||
| 317 | + padding: 0px 2px; | ||
| 318 | + cursor: pointer; | ||
| 319 | + text-align: center; | ||
| 320 | + font-size: 0.8rem !important; | ||
| 321 | +} | ||
| 322 | + | ||
| 323 | +.buttons-box-right { | ||
| 324 | + position: absolute; | ||
| 325 | + right: 0; | ||
| 326 | +} | ||
| 327 | +</style> |
web_src/src/components/control.vue
| @@ -329,7 +329,7 @@ export default { | @@ -329,7 +329,7 @@ export default { | ||
| 329 | method: 'get', | 329 | method: 'get', |
| 330 | url: '/zlm/' + that.mediaServerChoose + '/index/api/getThreadsLoad' | 330 | url: '/zlm/' + that.mediaServerChoose + '/index/api/getThreadsLoad' |
| 331 | }).then(function (res) { | 331 | }).then(function (res) { |
| 332 | - if (res.data.code == 0) { | 332 | + if (res.data.code === 0) { |
| 333 | that.tableOption.xAxis.data.push(new Date().toLocaleTimeString('chinese', { | 333 | that.tableOption.xAxis.data.push(new Date().toLocaleTimeString('chinese', { |
| 334 | hour12: false | 334 | hour12: false |
| 335 | })); | 335 | })); |
| @@ -554,7 +554,7 @@ export default { | @@ -554,7 +554,7 @@ export default { | ||
| 554 | url: '/zlm/' + that.mediaServerChoose + '/index/api/restartServer' | 554 | url: '/zlm/' + that.mediaServerChoose + '/index/api/restartServer' |
| 555 | }).then(function (res) { | 555 | }).then(function (res) { |
| 556 | that.getAllSession(); | 556 | that.getAllSession(); |
| 557 | - if (res.data.code == 0) { | 557 | + if (res.data.code === 0) { |
| 558 | that.$message({ | 558 | that.$message({ |
| 559 | type: 'success', | 559 | type: 'success', |
| 560 | message: '操作完成' | 560 | message: '操作完成' |
web_src/src/components/dialog/StreamProxyEdit.vue
| @@ -200,7 +200,7 @@ export default { | @@ -200,7 +200,7 @@ export default { | ||
| 200 | method: 'get', | 200 | method: 'get', |
| 201 | url:`/api/platform/query/10000/1` | 201 | url:`/api/platform/query/10000/1` |
| 202 | }).then(function (res) { | 202 | }).then(function (res) { |
| 203 | - that.platformList = res.data.list; | 203 | + that.platformList = res.data.data.list; |
| 204 | }).catch(function (error) { | 204 | }).catch(function (error) { |
| 205 | console.log(error); | 205 | console.log(error); |
| 206 | }); | 206 | }); |
web_src/src/components/dialog/SyncChannelProgress.vue
| @@ -57,7 +57,7 @@ export default { | @@ -57,7 +57,7 @@ export default { | ||
| 57 | method: 'get', | 57 | method: 'get', |
| 58 | url:`/api/device/query/${this.deviceId}/sync_status/`, | 58 | url:`/api/device/query/${this.deviceId}/sync_status/`, |
| 59 | }).then((res) => { | 59 | }).then((res) => { |
| 60 | - if (res.data.code == 0) { | 60 | + if (res.data.code === 0) { |
| 61 | if (!this.syncFlag) { | 61 | if (!this.syncFlag) { |
| 62 | this.syncFlag = true; | 62 | this.syncFlag = true; |
| 63 | } | 63 | } |
web_src/src/components/dialog/addUser.vue
| @@ -142,13 +142,8 @@ export default { | @@ -142,13 +142,8 @@ export default { | ||
| 142 | url: "/api/role/all" | 142 | url: "/api/role/all" |
| 143 | }).then((res) => { | 143 | }).then((res) => { |
| 144 | this.loading = true; | 144 | this.loading = true; |
| 145 | - console.info(res) | ||
| 146 | - res.data | ||
| 147 | - console.info(res.data.code) | ||
| 148 | if (res.data.code === 0) { | 145 | if (res.data.code === 0) { |
| 149 | - console.info(res.data.data) | ||
| 150 | this.options=res.data.data | 146 | this.options=res.data.data |
| 151 | - | ||
| 152 | } | 147 | } |
| 153 | }).catch((error) => { | 148 | }).catch((error) => { |
| 154 | console.error(error) | 149 | console.error(error) |
web_src/src/components/dialog/catalogEdit.vue
| @@ -118,8 +118,7 @@ export default { | @@ -118,8 +118,7 @@ export default { | ||
| 118 | method:"post", | 118 | method:"post", |
| 119 | url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`, | 119 | url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`, |
| 120 | data: this.form | 120 | data: this.form |
| 121 | - }) | ||
| 122 | - .then((res)=> { | 121 | + }).then((res)=> { |
| 123 | if (res.data.code === 0) { | 122 | if (res.data.code === 0) { |
| 124 | if (this.submitCallback)this.submitCallback(this.form) | 123 | if (this.submitCallback)this.submitCallback(this.form) |
| 125 | }else { | 124 | }else { |
web_src/src/components/dialog/changePassword.vue
| @@ -96,7 +96,7 @@ export default { | @@ -96,7 +96,7 @@ export default { | ||
| 96 | password: this.newPassword | 96 | password: this.newPassword |
| 97 | } | 97 | } |
| 98 | }).then((res)=> { | 98 | }).then((res)=> { |
| 99 | - if (res.data === "success"){ | 99 | + if (res.data.code === 0) { |
| 100 | this.$message({ | 100 | this.$message({ |
| 101 | showClose: true, | 101 | showClose: true, |
| 102 | message: '修改成功,请重新登录', | 102 | message: '修改成功,请重新登录', |
web_src/src/components/dialog/changePasswordForAdmin.vue
| @@ -91,7 +91,7 @@ export default { | @@ -91,7 +91,7 @@ export default { | ||
| 91 | userId: this.form.id, | 91 | userId: this.form.id, |
| 92 | } | 92 | } |
| 93 | }).then((res)=> { | 93 | }).then((res)=> { |
| 94 | - if (res.data === "success"){ | 94 | + if (res.data.code === 0) { |
| 95 | this.$message({ | 95 | this.$message({ |
| 96 | showClose: true, | 96 | showClose: true, |
| 97 | message: '修改成功', | 97 | message: '修改成功', |
web_src/src/components/dialog/changePushKey.vue
| @@ -71,8 +71,7 @@ export default { | @@ -71,8 +71,7 @@ export default { | ||
| 71 | userId: this.form.id, | 71 | userId: this.form.id, |
| 72 | } | 72 | } |
| 73 | }).then((res)=> { | 73 | }).then((res)=> { |
| 74 | - console.log(res.data) | ||
| 75 | - if (res.data.msg === "success"){ | 74 | + if (res.data.code === 0) { |
| 76 | this.$message({ | 75 | this.$message({ |
| 77 | showClose: true, | 76 | showClose: true, |
| 78 | message: '修改成功', | 77 | message: '修改成功', |
web_src/src/components/dialog/chooseChannel.vue
| @@ -101,7 +101,7 @@ export default { | @@ -101,7 +101,7 @@ export default { | ||
| 101 | channelReduces: that.chooseData | 101 | channelReduces: that.chooseData |
| 102 | } | 102 | } |
| 103 | }).then((res)=>{ | 103 | }).then((res)=>{ |
| 104 | - if (res.data == true) { | 104 | + if (res.data.code === 0) { |
| 105 | that.$message({ | 105 | that.$message({ |
| 106 | showClose: true, | 106 | showClose: true, |
| 107 | message: '保存成功,', | 107 | message: '保存成功,', |
web_src/src/components/dialog/chooseChannelForCatalog.vue
| @@ -87,8 +87,7 @@ export default { | @@ -87,8 +87,7 @@ export default { | ||
| 87 | platformId: that.platformId, | 87 | platformId: that.platformId, |
| 88 | parentId: parentId | 88 | parentId: parentId |
| 89 | } | 89 | } |
| 90 | - }) | ||
| 91 | - .then((res)=> { | 90 | + }).then((res)=> { |
| 92 | if (res.data.code === 0) { | 91 | if (res.data.code === 0) { |
| 93 | if (typeof(callback) === 'function') { | 92 | if (typeof(callback) === 'function') { |
| 94 | callback(res.data.data) | 93 | callback(res.data.data) |
| @@ -140,8 +139,7 @@ export default { | @@ -140,8 +139,7 @@ export default { | ||
| 140 | id: id, | 139 | id: id, |
| 141 | platformId: this.platformId, | 140 | platformId: this.platformId, |
| 142 | } | 141 | } |
| 143 | - }) | ||
| 144 | - .then((res) => { | 142 | + }).then((res) => { |
| 145 | if (res.data.code === 0) { | 143 | if (res.data.code === 0) { |
| 146 | console.log("移除成功") | 144 | console.log("移除成功") |
| 147 | node.parent.loaded = false | 145 | node.parent.loaded = false |
| @@ -163,8 +161,7 @@ export default { | @@ -163,8 +161,7 @@ export default { | ||
| 163 | platformId: this.platformId, | 161 | platformId: this.platformId, |
| 164 | catalogId: id, | 162 | catalogId: id, |
| 165 | } | 163 | } |
| 166 | - }) | ||
| 167 | - .then((res)=> { | 164 | + }).then((res)=> { |
| 168 | if (res.data.code === 0) { | 165 | if (res.data.code === 0) { |
| 169 | this.defaultCatalogIdSign = id; | 166 | this.defaultCatalogIdSign = id; |
| 170 | } | 167 | } |
web_src/src/components/dialog/chooseChannelForStream.vue
| @@ -180,15 +180,17 @@ export default { | @@ -180,15 +180,17 @@ export default { | ||
| 180 | } | 180 | } |
| 181 | }) | 181 | }) |
| 182 | .then(function (res) { | 182 | .then(function (res) { |
| 183 | - that.total = res.data.total; | ||
| 184 | - that.gbStreams = res.data.list; | ||
| 185 | - that.gbChoosechannel = {}; | ||
| 186 | - // 防止出现表格错位 | ||
| 187 | - that.$nextTick(() => { | 183 | + if (res.data.code === 0) { |
| 184 | + that.total = res.data.data.total; | ||
| 185 | + that.gbStreams = res.data.data.list; | ||
| 186 | + that.gbChoosechannel = {}; | ||
| 187 | + // 防止出现表格错位 | ||
| 188 | + that.$nextTick(() => { | ||
| 188 | that.$refs.gbStreamsTable.doLayout(); | 189 | that.$refs.gbStreamsTable.doLayout(); |
| 189 | // 默认选中 | 190 | // 默认选中 |
| 190 | - that.eventEnable = true; | ||
| 191 | - }) | 191 | + that.eventEnable = true; |
| 192 | + }) | ||
| 193 | + } | ||
| 192 | }) | 194 | }) |
| 193 | .catch(function (error) { | 195 | .catch(function (error) { |
| 194 | console.log(error); | 196 | console.log(error); |
web_src/src/components/dialog/deviceEdit.vue
| @@ -122,7 +122,7 @@ export default { | @@ -122,7 +122,7 @@ export default { | ||
| 122 | params: this.form | 122 | params: this.form |
| 123 | }).then((res) => { | 123 | }).then((res) => { |
| 124 | console.log(res.data) | 124 | console.log(res.data) |
| 125 | - if (res.data.code == 0) { | 125 | + if (res.data.code === 0) { |
| 126 | this.listChangeCallback() | 126 | this.listChangeCallback() |
| 127 | }else { | 127 | }else { |
| 128 | this.$message({ | 128 | this.$message({ |
web_src/src/components/dialog/devicePlayer.vue
| @@ -438,6 +438,7 @@ export default { | @@ -438,6 +438,7 @@ export default { | ||
| 438 | this.playFromStreamInfo(false, streamInfo) | 438 | this.playFromStreamInfo(false, streamInfo) |
| 439 | }, | 439 | }, |
| 440 | getUrlByStreamInfo(){ | 440 | getUrlByStreamInfo(){ |
| 441 | + console.log(this.streamInfo) | ||
| 441 | if (location.protocol === "https:") { | 442 | if (location.protocol === "https:") { |
| 442 | this.videoUrl = this.streamInfo[this.player[this.activePlayer][1]] | 443 | this.videoUrl = this.streamInfo[this.player[this.activePlayer][1]] |
| 443 | }else { | 444 | }else { |
| @@ -452,9 +453,9 @@ export default { | @@ -452,9 +453,9 @@ export default { | ||
| 452 | this.$refs[this.activePlayer].pause() | 453 | this.$refs[this.activePlayer].pause() |
| 453 | that.$axios({ | 454 | that.$axios({ |
| 454 | method: 'post', | 455 | method: 'post', |
| 455 | - url: '/api/gb_record/convert/' + that.streamId | 456 | + url: '/api/play/convert/' + that.streamId |
| 456 | }).then(function (res) { | 457 | }).then(function (res) { |
| 457 | - if (res.data.code == 0) { | 458 | + if (res.data.code === 0) { |
| 458 | that.convertKey = res.data.key; | 459 | that.convertKey = res.data.key; |
| 459 | setTimeout(()=>{ | 460 | setTimeout(()=>{ |
| 460 | that.isLoging = false; | 461 | that.isLoging = false; |
web_src/src/components/dialog/onvifEdit.vue
| @@ -90,7 +90,7 @@ export default { | @@ -90,7 +90,7 @@ export default { | ||
| 90 | } | 90 | } |
| 91 | }).then((res) => { | 91 | }).then((res) => { |
| 92 | console.log(res.data) | 92 | console.log(res.data) |
| 93 | - if (res.data.code == 0) { | 93 | + if (res.data.code === 0) { |
| 94 | if (res.data.data != null) { | 94 | if (res.data.data != null) { |
| 95 | this.listChangeCallback(res.data.data) | 95 | this.listChangeCallback(res.data.data) |
| 96 | }else { | 96 | }else { |
web_src/src/components/dialog/pushStreamEdit.vue
| @@ -112,7 +112,7 @@ export default { | @@ -112,7 +112,7 @@ export default { | ||
| 112 | url:`/api/push/save_to_gb`, | 112 | url:`/api/push/save_to_gb`, |
| 113 | data: this.proxyParam | 113 | data: this.proxyParam |
| 114 | }).then( (res) => { | 114 | }).then( (res) => { |
| 115 | - if (res.data == "success") { | 115 | + if (res.data.code === 0) { |
| 116 | this.$message({ | 116 | this.$message({ |
| 117 | showClose: true, | 117 | showClose: true, |
| 118 | message: "保存成功", | 118 | message: "保存成功", |
web_src/src/components/dialog/recordDownload.vue
| @@ -84,15 +84,16 @@ export default { | @@ -84,15 +84,16 @@ export default { | ||
| 84 | method: 'get', | 84 | method: 'get', |
| 85 | url: `/api/gb_record/download/progress/${this.deviceId}/${this.channelId}/${this.stream}` | 85 | url: `/api/gb_record/download/progress/${this.deviceId}/${this.channelId}/${this.stream}` |
| 86 | }).then((res)=> { | 86 | }).then((res)=> { |
| 87 | - console.log(res) | ||
| 88 | - console.log(res.data.progress) | ||
| 89 | - this.streamInfo = res.data; | ||
| 90 | - if (parseFloat(res.data.progress) == 1) { | ||
| 91 | - this.percentage = 100; | ||
| 92 | - }else { | ||
| 93 | - this.percentage = (res.data.progress*100).toFixed(1); | 87 | + if (res.data.code === 0) { |
| 88 | + this.streamInfo = res.data.data; | ||
| 89 | + if (parseFloat(res.data.progress) == 1) { | ||
| 90 | + this.percentage = 100; | ||
| 91 | + }else { | ||
| 92 | + this.percentage = (res.data.progress*100).toFixed(1); | ||
| 93 | + } | ||
| 94 | + if (callback)callback(); | ||
| 94 | } | 95 | } |
| 95 | - if (callback)callback(); | 96 | + |
| 96 | }).catch((e) =>{ | 97 | }).catch((e) =>{ |
| 97 | 98 | ||
| 98 | }); | 99 | }); |
| @@ -140,7 +141,7 @@ export default { | @@ -140,7 +141,7 @@ export default { | ||
| 140 | endTime: null, | 141 | endTime: null, |
| 141 | } | 142 | } |
| 142 | }).then((res) =>{ | 143 | }).then((res) =>{ |
| 143 | - if (res.data.code === 0 && res.data.msg === "success") { | 144 | + if (res.data.code === 0 ) { |
| 144 | // 查询进度 | 145 | // 查询进度 |
| 145 | this.title = "录像文件处理中..." | 146 | this.title = "录像文件处理中..." |
| 146 | this.taskId = res.data.data; | 147 | this.taskId = res.data.data; |
| @@ -173,7 +174,7 @@ export default { | @@ -173,7 +174,7 @@ export default { | ||
| 173 | } | 174 | } |
| 174 | }).then((res) => { | 175 | }).then((res) => { |
| 175 | console.log(res) | 176 | console.log(res) |
| 176 | - if (res.data.code == 0) { | 177 | + if (res.data.code === 0) { |
| 177 | this.percentage = parseFloat(res.data.data.percentage)*100 | 178 | this.percentage = parseFloat(res.data.data.percentage)*100 |
| 178 | if (res.data.data[0].percentage === '1') { | 179 | if (res.data.data[0].percentage === '1') { |
| 179 | this.getProgressForFileRun = false; | 180 | this.getProgressForFileRun = false; |
web_src/src/components/live.vue
| @@ -137,9 +137,6 @@ export default { | @@ -137,9 +137,6 @@ export default { | ||
| 137 | method: 'get', | 137 | method: 'get', |
| 138 | url: '/api/play/start/' + deviceId + '/' + channelId | 138 | url: '/api/play/start/' + deviceId + '/' + channelId |
| 139 | }).then(function (res) { | 139 | }).then(function (res) { |
| 140 | - // that.isLoging = false; | ||
| 141 | - console.log('=====----=====') | ||
| 142 | - console.log(res) | ||
| 143 | if (res.data.code === 0 && res.data.data) { | 140 | if (res.data.code === 0 && res.data.data) { |
| 144 | itemData.playUrl = res.data.data.httpsFlv | 141 | itemData.playUrl = res.data.data.httpsFlv |
| 145 | that.setPlayUrl(res.data.data.ws_flv, idxTmp) | 142 | that.setPlayUrl(res.data.data.ws_flv, idxTmp) |
web_src/src/components/map.vue
| @@ -302,7 +302,6 @@ export default { | @@ -302,7 +302,6 @@ export default { | ||
| 302 | }).then(function (res) { | 302 | }).then(function (res) { |
| 303 | that.isLoging = false; | 303 | that.isLoging = false; |
| 304 | if (res.data.code === 0) { | 304 | if (res.data.code === 0) { |
| 305 | - | ||
| 306 | that.$refs.devicePlayer.openDialog("media", deviceId, channelId, { | 305 | that.$refs.devicePlayer.openDialog("media", deviceId, channelId, { |
| 307 | streamInfo: res.data.data, | 306 | streamInfo: res.data.data, |
| 308 | hasAudio: channel.hasAudio | 307 | hasAudio: channel.hasAudio |
web_src/src/components/service/DeviceService.js
| @@ -43,10 +43,10 @@ class DeviceService{ | @@ -43,10 +43,10 @@ class DeviceService{ | ||
| 43 | 43 | ||
| 44 | getAllDeviceListIteration(deviceList, currentPage, count, callback, endCallback, errorCallback) { | 44 | getAllDeviceListIteration(deviceList, currentPage, count, callback, endCallback, errorCallback) { |
| 45 | this.getDeviceList(currentPage, count, (data) => { | 45 | this.getDeviceList(currentPage, count, (data) => { |
| 46 | - if (data.list) { | ||
| 47 | - if (typeof (callback) == "function") callback(data.list) | ||
| 48 | - deviceList = deviceList.concat(data.list); | ||
| 49 | - if (deviceList.length < data.total) { | 46 | + if (data.code === 0 && data.data.list) { |
| 47 | + if (typeof (callback) == "function") callback(data.data.list) | ||
| 48 | + deviceList = deviceList.concat(data.data.list); | ||
| 49 | + if (deviceList.length < data.data.total) { | ||
| 50 | currentPage ++ | 50 | currentPage ++ |
| 51 | this.getAllDeviceListIteration(deviceList, currentPage, count, callback, endCallback, errorCallback) | 51 | this.getAllDeviceListIteration(deviceList, currentPage, count, callback, endCallback, errorCallback) |
| 52 | }else { | 52 | }else { |
| @@ -134,10 +134,6 @@ class DeviceService{ | @@ -134,10 +134,6 @@ class DeviceService{ | ||
| 134 | }).catch(errorCallback); | 134 | }).catch(errorCallback); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | - getTree(deviceId, id, param3, param4) { | ||
| 138 | - | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | getTree(deviceId, parentId, onlyCatalog, callback, endCallback, errorCallback) { | 137 | getTree(deviceId, parentId, onlyCatalog, callback, endCallback, errorCallback) { |
| 142 | let currentPage = 1; | 138 | let currentPage = 1; |
| 143 | let count = 100; | 139 | let count = 100; |
| @@ -147,10 +143,10 @@ class DeviceService{ | @@ -147,10 +143,10 @@ class DeviceService{ | ||
| 147 | 143 | ||
| 148 | getTreeIteration(deviceId, parentId, onlyCatalog, catalogList, currentPage, count, callback, endCallback, errorCallback) { | 144 | getTreeIteration(deviceId, parentId, onlyCatalog, catalogList, currentPage, count, callback, endCallback, errorCallback) { |
| 149 | this.getTreeInfo(deviceId, parentId, onlyCatalog, currentPage, count, (data) => { | 145 | this.getTreeInfo(deviceId, parentId, onlyCatalog, currentPage, count, (data) => { |
| 150 | - if (data.list) { | ||
| 151 | - if (typeof (callback) == "function") callback(data.list) | ||
| 152 | - catalogList = catalogList.concat(data.list); | ||
| 153 | - if (catalogList.length < data.total) { | 146 | + if (data.code === 0 && data.data.list) { |
| 147 | + if (typeof (callback) == "function") callback(data.data.list) | ||
| 148 | + catalogList = catalogList.concat(data.data.list); | ||
| 149 | + if (catalogList.length < data.data.total) { | ||
| 154 | currentPage ++ | 150 | currentPage ++ |
| 155 | this.getTreeIteration(deviceId, parentId, onlyCatalog, catalogList, currentPage, count, callback, endCallback, errorCallback) | 151 | this.getTreeIteration(deviceId, parentId, onlyCatalog, catalogList, currentPage, count, callback, endCallback, errorCallback) |
| 156 | }else { | 152 | }else { |