| | |
| | | @Autowired
|
| | | private MediaConfig mediaConfig;
|
| | |
|
| | | @Autowired
|
| | | private ZLMRESTfulUtils zlmresTfulUtils;
|
| | |
|
| | | /**
|
| | | * 服务器定时上报时间,上报间隔可配置,默认10s上报一次
|
| | | *
|
| | |
| | | @PostMapping(value = "/on_publish", produces = "application/json;charset=UTF-8")
|
| | | public ResponseEntity<String> onPublish(@RequestBody JSONObject json) {
|
| | |
|
| | | logger.debug("[ ZLM HOOK ]on_publish API调用,参数:" + json.toString());
|
| | | logger.info("[ ZLM HOOK ]on_publish API调用,参数:" + json.toString());
|
| | | JSONObject ret = new JSONObject();
|
| | | ret.put("code", 0);
|
| | | ret.put("msg", "success");
|
| | |
| | | streamProxyService.del(app, streamId);
|
| | | String url = streamProxyItem.getUrl() != null?streamProxyItem.getUrl():streamProxyItem.getSrc_url();
|
| | | logger.info("[{}/{}]<-[{}] 拉流代理无人观看已经移除", app, streamId, url);
|
| | |
|
| | | }else if (streamProxyItem != null && streamProxyItem.isEnable()) {
|
| | | MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
|
| | | if(null!=mediaServerItem){
|
| | | JSONObject jsonObject = zlmresTfulUtils.closeStreams(mediaServerItem,streamProxyItem.getApp(), streamProxyItem.getStream());
|
| | | if (jsonObject.getInteger("code") == 0) {
|
| | | streamProxyItem.setEnable(false);
|
| | | storager.updateStreamProxy(streamProxyItem);
|
| | | }
|
| | | }else {
|
| | | ret.put("close", false);
|
| | | }
|
| | | }else {
|
| | | ret.put("close", false);
|
| | | }
|