添加getMediaInfo接口

夏楚
2019-12-13 13:54:05 +08:00
parent c0134eb8ac
commit b49b4bbdc2

@@ -22,7 +22,8 @@ MediaServer是ZLMediaKit的主进程目前支持以下http api接口这些
"/index/api/isMediaOnline",
"/index/api/startRecord",
"/index/api/stopRecord",
"/index/api/getRecordStatus"
"/index/api/getRecordStatus",
"/index/api/getMediaInfo"
```
@@ -661,3 +662,43 @@ MediaServer是ZLMediaKit的主进程目前支持以下http api接口这些
"status" : 1 # 0:未录制,1:等待流注册,注册成功后立即开始录制,2:流已注册,并且正在录制
}
```
### 20、`/index/api/getMediaInfo`
- 功能:判断直播流是否在线
- 范例:[http://127.0.0.1/index/api/getMediaInfo?schema=rtsp&vhost=`__defaultVhost__`&app=live&stream=obs](http://127.0.0.1/index/api/getMediaInfo?schema=rtsp&vhost=__defaultVhost__&app=live&stream=obs)
- 参数:
| 参数 | 是否必选 | 释意 |
| :----: | :------: | :----------------------------------------------------------: |
| secret | Y | api操作密钥(配置文件配置)如果操作ip是127.0.0.1,则不需要此参数 |
| schema | Y | 协议,例如 rtsp或rtmp |
| vhost | Y | 虚拟主机,例如`__defaultVhost__` |
| app | Y | 应用名,例如 live |
| stream | Y | 流id例如 obs |
- 响应:
```json
{
"code" : 0,
"online" : true, # 是否在线
"readerCount" : 0, # 总观看人数包括rtsp/rtmp
"tracks" : [ # 轨道列表
{
"codec_id" : 0, # H264 = 0, H265 = 1, AAC = 2
"codec_type" : 0, # Video = 0, Audio = 1
"ready" : true # 轨道是否准备就绪
},
{
"codec_id" : 2,
"codec_type" : 1,
"ready" : true
}
]
}
```