diff --git a/MediaServer支持的HTTP-API.md b/MediaServer支持的HTTP-API.md index 8def51f..9b05ce0 100644 --- a/MediaServer支持的HTTP-API.md +++ b/MediaServer支持的HTTP-API.md @@ -22,7 +22,10 @@ MediaServer是ZLMediaKit的主进程,目前支持以下http api接口,这些 "/index/api/isMediaOnline", "/index/api/getMediaInfo", "/index/api/getSsrcInfo", - "/index/api/getMp4RecordFile" + "/index/api/getMp4RecordFile", + "/index/api/startRecord", + "/index/api/stopRecord", + "/index/api/getRecordStatus", ``` @@ -696,6 +699,90 @@ MediaServer是ZLMediaKit的主进程,目前支持以下http api接口,这些 ``` +### 20、`/index/api/startRecord` + + - 功能:开始录制hls或MP4 + + - 范例:[http://127.0.0.1/index/api/startRecord?type=1&vhost=`__defaultVhost__`&app=live&stream=obs&wait_for_record=1&continue_record=1](http://127.0.0.1/index/api/startRecord?type=1&vhost=__defaultVhost__&app=live&stream=obs&wait_for_record=1&continue_record=1) + + - 参数: + + | 参数 | 是否必选 | 释意 | 类型 | + | :-------------: | :------: | :----------------------------------------------------------: | ------ | + | secret | Y | api操作密钥(配置文件配置),如果操作ip是127.0.0.1,则不需要此参数 | string | + | type | Y | 0为hls,1为mp4 | 0/1 | + | vhost | Y | 虚拟主机,例如`__defaultVhost__` | string | + | app | Y | 应用名,例如 live | string | + | stream | Y | 流id,例如 obs | string | + | customized_path | N | 录像保存目录 | string | + + + - 响应: + + ```json + { + "code" : 0, + "result" : true # 成功与否 + } + ``` + + +### 21、`/index/api/stopRecord` + + - 功能:停止录制流 + + - 范例:[http://127.0.0.1/index/api/stopRecord?type=1&vhost=`__defaultVhost__`&app=live&stream=obs](http://127.0.0.1/index/api/stopRecord?type=1&vhost=__defaultVhost__&app=live&stream=obs) + + - 参数: + + | 参数 | 是否必选 | 释意 | + | :----: | :------: | :----------------------------------------------------------: | + | secret | Y | api操作密钥(配置文件配置),如果操作ip是127.0.0.1,则不需要此参数 | + | type | Y | 0为hls,1为mp4 | + | vhost | Y | 虚拟主机,例如`__defaultVhost__` | + | app | Y | 应用名,例如 live | + | stream | Y | 流id,例如 obs | + + + - 响应: + + ```json + { + "code" : 0, + "result" : true # 成功与否 + } + ``` + + + +### 22、`/index/api/isRecording + + - 功能:获取流录制状态 + + - 范例:[http://127.0.0.1/index/api/getRecordStatus?type=1&vhost=`__defaultVhost__`&app=live&stream=obs](http://127.0.0.1/index/api/getRecordStatus?type=1&vhost=__defaultVhost__&app=live&stream=obs) + + - 参数: + + | 参数 | 是否必选 | 释意 | + | :----: | :------: | :----------------------------------------------------------: | + | secret | Y | api操作密钥(配置文件配置),如果操作ip是127.0.0.1,则不需要此参数 | + | type | Y | 0为hls,1为mp4 | + | vhost | Y | 虚拟主机,例如`__defaultVhost__` | + | app | Y | 应用名,例如 live | + | stream | Y | 流id,例如 obs | + + + - 响应: + + ```json + { + "code" : 0, + "status" : true # false:未录制,true:正在录制 + } + ``` + + +