增加无人观看时关闭zlm拉流

pull/353/head
luoshuyue 2022-02-25 15:06:51 +08:00
parent ce56d9c0bf
commit 0cc0a21206
1 changed files with 15 additions and 0 deletions

View File

@ -83,6 +83,9 @@ public class ZLMHttpHookListener {
@Autowired @Autowired
private MediaConfig mediaConfig; private MediaConfig mediaConfig;
@Autowired
private ZLMRESTfulUtils zlmresTfulUtils;
/** /**
* 10s * 10s
* *
@ -465,6 +468,18 @@ public class ZLMHttpHookListener {
streamProxyService.del(app, streamId); streamProxyService.del(app, streamId);
String url = streamProxyItem.getUrl() != null?streamProxyItem.getUrl():streamProxyItem.getSrc_url(); String url = streamProxyItem.getUrl() != null?streamProxyItem.getUrl():streamProxyItem.getSrc_url();
logger.info("[{}/{}]<-[{}] 拉流代理无人观看已经移除", app, streamId, 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 { }else {
ret.put("close", false); ret.put("close", false);
} }