| | |
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | /**
|
| | | * @Description:针对 ZLMediaServer的hook事件监听
|
| | | * @description:针对 ZLMediaServer的hook事件监听
|
| | | * @author: swwheihei
|
| | | * @date: 2020年5月8日 上午10:46:48
|
| | | */
|
| | |
| | | String streamId = json.getString("stream");
|
| | | String app = json.getString("app");
|
| | |
|
| | | // TODO 如果在给上级推流,也不停止。
|
| | | if ("rtp".equals(app)){
|
| | | JSONObject ret = new JSONObject();
|
| | | ret.put("code", 0);
|
| | |
| | | cmder.streamByeCmd(streamInfoForPlayBackCatch.getDeviceID(), streamInfoForPlayBackCatch.getChannelId());
|
| | | redisCatchStorage.stopPlayback(streamInfoForPlayBackCatch);
|
| | | }
|
| | | }
|
| | | MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
|
| | | if (mediaServerItem != null && "-1".equals(mediaServerItem.getStreamNoneReaderDelayMS())) {
|
| | | ret.put("close", false);
|
| | | }
|
| | | return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
|
| | | }else {
|
| | |
| | | if (userSetup.isAutoApplyPlay() && mediaInfo != null) {
|
| | | String app = json.getString("app");
|
| | | String streamId = json.getString("stream");
|
| | | if ("rtp".equals(app) && streamId.contains("gb_play") ) {
|
| | | if ("rtp".equals(app)) {
|
| | | String[] s = streamId.split("_");
|
| | | if (s.length == 4) {
|
| | | String deviceId = s[2];
|
| | | String channelId = s[3];
|
| | | if (s.length == 2) {
|
| | | String deviceId = s[0];
|
| | | String channelId = s[1];
|
| | | Device device = storager.queryVideoDevice(deviceId);
|
| | | if (device != null) {
|
| | | UUID uuid = UUID.randomUUID();
|
| | | SSRCInfo ssrcInfo;
|
| | | String streamId2 = null;
|
| | | if (mediaInfo.isRtpEnable()) {
|
| | | streamId2 = String.format("gb_play_%s_%s", device.getDeviceId(), channelId);
|
| | | streamId2 = String.format("%s_%s", device.getDeviceId(), channelId);
|
| | | }
|
| | | ssrcInfo = mediaServerService.openRTPServer(mediaInfo, streamId2);
|
| | | cmder.playStreamCmd(mediaInfo, ssrcInfo, device, channelId, (MediaServerItem mediaServerItemInuse, JSONObject response) -> {
|