diff --git a/MediaServer支持的HTTP-API.md b/MediaServer支持的HTTP-API.md index 975818a..93b0d1b 100644 --- a/MediaServer支持的HTTP-API.md +++ b/MediaServer支持的HTTP-API.md @@ -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" ``` @@ -660,4 +661,44 @@ MediaServer是ZLMediaKit的主进程,目前支持以下http api接口,这些 "code" : 0, "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 + } + ] + } ``` \ No newline at end of file