添加无人观看主动断开事件

This commit is contained in:
xiongziliang
2019-05-27 18:39:43 +08:00
parent 3917b6451c
commit b0bf216bc2
21 changed files with 213 additions and 52 deletions

View File

@@ -343,7 +343,7 @@ void installWebApi() {
});
//主动关断流,包括关断拉流、推流
//测试url http://127.0.0.1/index/api/close_stream?schema=rtsp&vhost=__defaultVhost__&app=live&stream=obs
//测试url http://127.0.0.1/index/api/close_stream?schema=rtsp&vhost=__defaultVhost__&app=live&stream=obs&force=1
API_REGIST(api,close_stream,{
CHECK_SECRET();
CHECK_ARGS("schema","vhost","app","stream");
@@ -353,7 +353,7 @@ void installWebApi() {
allArgs["app"],
allArgs["stream"]);
if(src){
bool flag = src->close();
bool flag = src->close(allArgs["force"].as<bool>());
val["code"] = flag ? 0 : -1;
val["msg"] = flag ? "success" : "close failed";
}else{
@@ -511,6 +511,13 @@ void installWebApi() {
//shell登录调试事件
throw SuccessException();
});
API_REGIST(hook,on_stream_none_reader,{
//无人观看流默认关闭
val["close"] = true;
});
}
void unInstallWebApi(){