|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  | private SIPCommander cmder; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IVideoManagerStorager storager; | 
|---|
|  |  |  | private IVideoManagerStorage storager; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IRedisCatchStorage redisCatchStorage; | 
|---|
|  |  |  | 
|---|
|  |  |  | logger.debug(String.format("设备回放 API调用,deviceId:%s ,channelId:%s", deviceId, channelId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DeferredResult<ResponseEntity<String>> result = playService.playBack(deviceId, channelId, startTime, endTime, wvpResult->{ | 
|---|
|  |  |  | DeferredResult<ResponseEntity<String>> result = playService.playBack(deviceId, channelId, startTime, endTime, null, wvpResult->{ | 
|---|
|  |  |  | resultHolder.invokeResult(wvpResult.getData()); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @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)); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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不存在!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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不存在!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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不存在!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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不存在!"); | 
|---|