From b6b01dc2f96ca9dc25bd5d055fb3925974edb610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E6=A5=9A?= <771730766@qq.com> Date: Sun, 5 Apr 2020 09:35:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=BD=95=E5=88=B6=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MediaServer支持的HTTP-API.md | 89 +++++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) 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:正在录制 + } + ``` + + +