加入录制相关接口

夏楚
2020-04-05 09:35:38 +08:00
parent e1e330b9e7
commit b6b01dc2f9

@@ -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为hls1为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为hls1为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为hls1为mp4 |
| vhost | Y | 虚拟主机,例如`__defaultVhost__` |
| app | Y | 应用名,例如 live |
| stream | Y | 流id例如 obs |
- 响应:
```json
{
"code" : 0,
"status" : true # false:未录制,true:正在录制
}
```