648540858
2020-11-16 0898c63ca3de75669f88354b23eeb2798d1db471
src/main/java/com/genersoft/iot/vmp/vmanager/play/PlayController.java
@@ -38,10 +38,15 @@
   @Autowired
   private ZLMRESTfulUtils zlmresTfulUtils;
   @Value("${media.closeWaitRTPInfo}")
   private boolean closeWaitRTPInfo;
   @GetMapping("/play/{deviceId}/{channelId}")
   public ResponseEntity<String> play(@PathVariable String deviceId, @PathVariable String channelId,
   Integer getEncoding) {
      if (getEncoding == null) getEncoding = 0;
      getEncoding = closeWaitRTPInfo ?  0: getEncoding;
      Device device = storager.queryVideoDevice(deviceId);
      StreamInfo streamInfo = storager.queryPlayByDevice(deviceId, channelId);
@@ -56,7 +61,6 @@
            storager.stopPlay(streamInfo);
            streamInfo = cmder.playStreamCmd(device, channelId);
         }
      }
      String streamId = String.format("%08x", Integer.parseInt(streamInfo.getSsrc())).toUpperCase();
      // 等待推流, TODO 默认超时30s
@@ -103,7 +107,7 @@
            }
         }
      } else {
         String flv = storager.getMediaInfo().getLocalIP() + ":" + storager.getMediaInfo().getHttpPort() + "/rtp/"
         String flv = storager.getMediaInfo().getWanIp() + ":" + storager.getMediaInfo().getHttpPort() + "/rtp/"
               + streamId + ".flv";
         streamInfo.setFlv("http://" + flv);
         streamInfo.setWs_flv("ws://" + flv);
@@ -130,7 +134,7 @@
      cmder.streamByeCmd(ssrc);
      StreamInfo streamInfo = storager.queryPlayBySSRC(ssrc);
      if (streamInfo == null)
         return new ResponseEntity<String>(HttpStatus.PAYMENT_REQUIRED);
         return new ResponseEntity<String>("ssrc not found", HttpStatus.OK);
      storager.stopPlay(streamInfo);
      if (logger.isDebugEnabled()) {
         logger.debug(String.format("设备预览停止API调用,ssrc:%s", ssrc));
@@ -146,3 +150,4 @@
      }
   }
}