mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-03-04 05:00:54 +08:00
完善主动关断流机制
This commit is contained in:
@@ -338,7 +338,8 @@ void installWebApi() {
|
||||
});
|
||||
});
|
||||
|
||||
API_REGIST(api,kick_pusher,{
|
||||
//主动关断流,包括关断拉流、推流
|
||||
API_REGIST(api,close_stream,{
|
||||
CHECK_SECRET();
|
||||
CHECK_ARGS("schema","vhost","app","stream");
|
||||
//踢掉推流器
|
||||
@@ -405,6 +406,12 @@ void installWebApi() {
|
||||
const_cast<PlayerProxy::Ptr &>(player).reset();
|
||||
invoker("200 OK", headerOut, val.toStyledString());
|
||||
});
|
||||
|
||||
//被主动关闭拉流
|
||||
player->setOnClose([key](){
|
||||
lock_guard<recursive_mutex> lck(s_proxyMapMtx);
|
||||
s_proxyMap.erase(key);
|
||||
});
|
||||
player->play(allArgs["url"]);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user