| | |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device;
|
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
|
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
| | | import com.genersoft.iot.vmp.service.IMediaServerService;
|
| | | import com.genersoft.iot.vmp.service.IMediaService;
|
| | | import com.genersoft.iot.vmp.service.IStreamProxyService;
|
| | | import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
| | |
| | |
|
| | | @Autowired
|
| | | private IMediaServerService mediaServerService;
|
| | |
|
| | | @Autowired
|
| | | private IStreamProxyService streamProxyService;
|
| | |
|
| | | @Autowired
|
| | | private IMediaService mediaService;
|
| | |
| | | subscribe.response(mediaInfo, json);
|
| | | }
|
| | | }
|
| | | String app = json.getString("app");
|
| | | String stream = json.getString("stream");
|
| | | StreamInfo streamInfo = redisCatchStorage.queryPlaybackByStreamId(stream);
|
| | | JSONObject ret = new JSONObject();
|
| | | // 录像回放时不进行录像下载
|
| | | if (streamInfo != null) {
|
| | | ret.put("enableMP4", false);
|
| | | }else {
|
| | | ret.put("enableMP4", userSetup.isRecordPushLive());
|
| | | }
|
| | | ret.put("code", 0);
|
| | | ret.put("msg", "success");
|
| | | ret.put("enableHls", true);
|
| | | ret.put("enableMP4", userSetup.isRecordPushLive());
|
| | | ret.put("enableRtxp", true);
|
| | | return new ResponseEntity<String>(ret.toString(), HttpStatus.OK);
|
| | | }
|
| | |
|
| | |
| | | String mediaServerId = json.getString("mediaServerId");
|
| | | String streamId = json.getString("stream");
|
| | | String app = json.getString("app");
|
| | |
|
| | | // TODO 如果在给上级推流,也不停止。
|
| | | JSONObject ret = new JSONObject();
|
| | | ret.put("code", 0);
|
| | | if ("rtp".equals(app)){
|
| | | JSONObject ret = new JSONObject();
|
| | | ret.put("code", 0);
|
| | | ret.put("close", true);
|
| | | StreamInfo streamInfoForPlayCatch = redisCatchStorage.queryPlayByStreamId(streamId);
|
| | | if (streamInfoForPlayCatch != null) {
|
| | | // 如果在给上级推流,也不停止。
|
| | | if (redisCatchStorage.isChannelSendingRTP(streamInfoForPlayCatch.getChannelId())) {
|
| | | ret.put("close", false);
|
| | | } else {
|
| | |
| | | if (streamInfoForPlayBackCatch != null) {
|
| | | cmder.streamByeCmd(streamInfoForPlayBackCatch.getDeviceID(), streamInfoForPlayBackCatch.getChannelId());
|
| | | redisCatchStorage.stopPlayback(streamInfoForPlayBackCatch);
|
| | | }else {
|
| | | StreamInfo streamInfoForDownload = redisCatchStorage.queryDownloadByStreamId(streamId);
|
| | | // 进行录像下载时无人观看不断流
|
| | | if (streamInfoForDownload != null) {
|
| | | ret.put("close", false);
|
| | | }
|
| | | }
|
| | | }
|
| | | MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
|
| | |
| | | }
|
| | | return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
|
| | | }else {
|
| | | JSONObject ret = new JSONObject();
|
| | | ret.put("code", 0);
|
| | | ret.put("close", false);
|
| | | StreamProxyItem streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(app, streamId);
|
| | | if (streamProxyItem != null && streamProxyItem.isEnable_remove_none_reader()) {
|
| | | ret.put("close", true);
|
| | | streamProxyService.del(app, streamId);
|
| | | String url = streamProxyItem.getUrl() != null?streamProxyItem.getUrl():streamProxyItem.getSrc_url();
|
| | | logger.info("[{}/{}]<-[{}] 拉流代理无人观看已经移除", app, streamId, url);
|
| | | }else {
|
| | | ret.put("close", false);
|
| | | }
|
| | | return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
|
| | | }
|
| | |
|