From b49b4bbdc2884c8482d28fbff4a4b42c6cd0a295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E6=A5=9A?= <771730766@qq.com> Date: Fri, 13 Dec 2019 13:54:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0getMediaInfo=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MediaServer支持的HTTP-API.md | 43 +++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) 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