增加接收Bye请求后停止向上级推流功能

This commit is contained in:
lawrencehj
2021-03-10 14:39:40 +08:00
parent 343882e4c4
commit 2c1dbe63de
4 changed files with 66 additions and 4 deletions

View File

@@ -123,4 +123,8 @@ public class ZLMRESTfulUtils {
public JSONObject startSendRtp(Map<String, Object> param) {
return sendPost("startSendRtp",param);
}
public JSONObject stopSendRtp(Map<String, Object> param) {
return sendPost("stopSendRtp",param);
}
}

View File

@@ -151,4 +151,22 @@ public class ZLMRTPServerFactory {
JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo("rtp", "rtmp", streamId);
return (mediaInfo.getInteger("code") == 0 && mediaInfo.getBoolean("online"));
}
/**
* 调用zlm RESTful API —— stopSendRtp
*/
public Boolean stopSendRtpStream(Map<String, Object>param) {
Boolean result = false;
JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(param);
System.out.println(jsonObject);
if (jsonObject == null) {
logger.error("停止RTP推流失败: 请检查ZLM服务");
} else if (jsonObject.getInteger("code") == 0) {
result= true;
logger.error("停止RTP推流成功");
} else {
logger.error("停止RTP推流失败: " + jsonObject.getString("msg"));
}
return result;
}
}