648540858
2022-05-06 5d901b5e3f033e8b04e53420d68626cbd87431c8
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
@@ -2,11 +2,8 @@
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
//import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.service.IMediaServerService;
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.service.IPlayService;
import io.swagger.annotations.Api;
@@ -28,10 +25,8 @@
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import org.springframework.web.context.request.async.DeferredResult;
import java.util.UUID;
@Api(tags = "视频回放")
@CrossOrigin
@@ -45,7 +40,7 @@
   private SIPCommander cmder;
   @Autowired
   private IVideoManagerStorager storager;
   private IVideoManagerStorage storager;
   @Autowired
   private IRedisCatchStorage redisCatchStorage;
@@ -77,8 +72,8 @@
         logger.debug(String.format("设备回放 API调用,deviceId:%s ,channelId:%s", deviceId, channelId));
      }
      DeferredResult<ResponseEntity<String>> result = playService.playBack(deviceId, channelId, startTime, endTime, msg->{
         resultHolder.invokeResult(msg);
      DeferredResult<ResponseEntity<String>> result = playService.playBack(deviceId, channelId, startTime, endTime, null, wvpResult->{
         resultHolder.invokeResult(wvpResult.getData());
      });
      return result;
@@ -96,7 +91,7 @@
         @PathVariable String channelId,
         @PathVariable String stream) {
      cmder.streamByeCmd(deviceId, channelId, stream);
      cmder.streamByeCmd(deviceId, channelId, stream, null);
      if (logger.isDebugEnabled()) {
         logger.debug(String.format("设备录像回放停止 API调用,deviceId/channelId:%s/%s", deviceId, channelId));
@@ -124,7 +119,7 @@
   public ResponseEntity<String> playPause(@PathVariable String streamId) {
      logger.info("playPause: "+streamId);
      JSONObject json = new JSONObject();
      StreamInfo streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
      StreamInfo streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null);
      if (null == streamInfo) {
         json.put("msg", "streamId不存在");
         logger.warn("streamId不存在!");
@@ -144,7 +139,7 @@
   public ResponseEntity<String> playResume(@PathVariable String streamId) {
      logger.info("playResume: "+streamId);
      JSONObject json = new JSONObject();
      StreamInfo streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
      StreamInfo streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null);
      if (null == streamInfo) {
         json.put("msg", "streamId不存在");
         logger.warn("streamId不存在!");
@@ -165,7 +160,7 @@
   public ResponseEntity<String> playSeek(@PathVariable String streamId, @PathVariable long seekTime) {
      logger.info("playSeek: "+streamId+", "+seekTime);
      JSONObject json = new JSONObject();
      StreamInfo streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
      StreamInfo streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null);
      if (null == streamInfo) {
         json.put("msg", "streamId不存在");
         logger.warn("streamId不存在!");
@@ -186,7 +181,7 @@
   public ResponseEntity<String> playSpeed(@PathVariable String streamId, @PathVariable Double speed) {
      logger.info("playSpeed: "+streamId+", "+speed);
      JSONObject json = new JSONObject();
      StreamInfo streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
      StreamInfo streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null);
      if (null == streamInfo) {
         json.put("msg", "streamId不存在");
         logger.warn("streamId不存在!");