mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 20:27:34 +08:00
添加录制相关http api
This commit is contained in:
parent
f581f0f2a7
commit
69c0c3e237
@ -692,6 +692,40 @@ void installWebApi() {
|
|||||||
invoker.responseFile(headerIn,StrCaseMap(),exePath());
|
invoker.responseFile(headerIn,StrCaseMap(),exePath());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 开始录制hls或MP4
|
||||||
|
API_REGIST_INVOKER(api,startRecord,{
|
||||||
|
CHECK_SECRET();
|
||||||
|
CHECK_ARGS("type","vhost","app","stream","wait_for_record","continue_record");
|
||||||
|
int result = Recorder::startRecord((Recorder::type)allArgs["type"].as<int>(),
|
||||||
|
allArgs["vhost"],
|
||||||
|
allArgs["app"],
|
||||||
|
allArgs["stream"],
|
||||||
|
allArgs["wait_for_record"],
|
||||||
|
allArgs["continue_record"]);
|
||||||
|
val["result"] = result;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 停止录制hls或MP4
|
||||||
|
API_REGIST_INVOKER(api,stopRecord,{
|
||||||
|
CHECK_SECRET();
|
||||||
|
CHECK_ARGS("type","vhost","app","stream");
|
||||||
|
Recorder::stopRecord((Recorder::type)allArgs["type"].as<int>(),
|
||||||
|
allArgs["vhost"],
|
||||||
|
allArgs["app"],
|
||||||
|
allArgs["stream"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取hls或MP4录制状态
|
||||||
|
API_REGIST_INVOKER(api,stopRecord,{
|
||||||
|
CHECK_SECRET();
|
||||||
|
CHECK_ARGS("type","vhost","app","stream");
|
||||||
|
auto status = Recorder::getRecordStatus((Recorder::type)allArgs["type"].as<int>(),
|
||||||
|
allArgs["vhost"],
|
||||||
|
allArgs["app"],
|
||||||
|
allArgs["stream"]);
|
||||||
|
val["status"] = (int)status;
|
||||||
|
});
|
||||||
|
|
||||||
////////////以下是注册的Hook API////////////
|
////////////以下是注册的Hook API////////////
|
||||||
API_REGIST(hook,on_publish,{
|
API_REGIST(hook,on_publish,{
|
||||||
//开始推流事件
|
//开始推流事件
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
* @param app 应用名
|
* @param app 应用名
|
||||||
* @param stream_id 流id
|
* @param stream_id 流id
|
||||||
* @param waitForRecord 是否等待流注册后再录制,未注册时,置false将返回失败
|
* @param waitForRecord 是否等待流注册后再录制,未注册时,置false将返回失败
|
||||||
* @param continueRecord 流注销时是否继续等待录制还是立即停止注册
|
* @param continueRecord 流注销时是否继续等待录制还是立即停止录制
|
||||||
* @return 0代表成功,负数代表失败
|
* @return 0代表成功,负数代表失败
|
||||||
*/
|
*/
|
||||||
static int startRecord(type type, const string &vhost, const string &app, const string &stream_id,bool waitForRecord, bool continueRecord);
|
static int startRecord(type type, const string &vhost, const string &app, const string &stream_id,bool waitForRecord, bool continueRecord);
|
||||||
|
Loading…
Reference in New Issue
Block a user