| | |
| | | |
| | | @Override |
| | | public JSONObject removeStreamProxyFromZlm(StreamProxyItem param) { |
| | | if (param ==null) return null; |
| | | if (param ==null) { |
| | | return null; |
| | | } |
| | | MediaServerItem mediaServerItem = mediaServerService.getOne(param.getMediaServerId()); |
| | | JSONObject result = zlmresTfulUtils.closeStreams(mediaServerItem, param.getApp(), param.getStream()); |
| | | return result; |
| | |
| | | public boolean start(String app, String stream) { |
| | | boolean result = false; |
| | | StreamProxyItem streamProxy = videoManagerStorager.queryStreamProxy(app, stream); |
| | | if (!streamProxy.isEnable() && streamProxy != null) { |
| | | if (!streamProxy.isEnable() ) { |
| | | JSONObject jsonObject = addStreamProxyToZlm(streamProxy); |
| | | if (jsonObject == null) return false; |
| | | if (jsonObject == null) { |
| | | return false; |
| | | } |
| | | System.out.println(jsonObject); |
| | | if (jsonObject.getInteger("code") == 0) { |
| | | result = true; |
| | | streamProxy.setEnable(true); |
| | |
| | | StreamProxyItem streamProxyDto = videoManagerStorager.queryStreamProxy(app, stream); |
| | | if (streamProxyDto != null && streamProxyDto.isEnable()) { |
| | | JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyDto); |
| | | if (jsonObject.getInteger("code") == 0) { |
| | | if (jsonObject != null && jsonObject.getInteger("code") == 0) { |
| | | streamProxyDto.setEnable(false); |
| | | result = videoManagerStorager.updateStreamProxy(streamProxyDto); |
| | | } |
| | |
| | | } |
| | | streamProxyMapper.deleteAutoRemoveItemByMediaServerId(mediaServerId); |
| | | // 其他的流设置离线 |
| | | streamProxyMapper.updateStatusByMediaServerId(false, mediaServerId); |
| | | streamProxyMapper.updateStatusByMediaServerId(mediaServerId, false); |
| | | String type = "PULL"; |
| | | |
| | | // 发送redis消息 |
| | |
| | | |
| | | @Override |
| | | public int updateStatus(boolean status, String app, String stream) { |
| | | return streamProxyMapper.updateStatus(status, app, stream); |
| | | return streamProxyMapper.updateStatus(app, stream, status); |
| | | } |
| | | |
| | | private void syncPullStream(String mediaServerId){ |