/api/input/source/add
添加输入
需要输入输出编辑权限
接口原型
| 协议 | HTTP/HTTPS POST |
| URL | ip[:port]/api/input/source/add |
| 数据格式 | 请求消息:Content-Type: application/json 响应消息:Content-Type: application/json |
请求Cookies
| 名称 | 描述 |
|---|---|
| mwcloud-sid | 用于标识当前登录的字符串 |
| mwcloud-uid | 当前登录用户名 |
Request Body
| 参数 | 描述 |
|---|---|
| name | 名称 |
| config | 源配置信息 |
源配置信息
| 参数 | 描述 |
|---|---|
| type | 配置类型,为1表示url类型,通过url字段配置源信息,暂时无其它值 |
| url | 源地址 |
目前支持的协议有RTMP,RTSP,TS OVER SRT/UDP/RTP
RTSP
支持标准的RTSP地址
rtsp://192.168.1.58:899/stream
RTMP
支持标准的RTMP地址
rtmp://192.168.1.58/live/key
5. MPEG-TS over UDP
支持标准的UDP地址
// 组播
udp://ip:port
// 单播
udp://0.0.0.0:port
6. MPEG-TS over SRT
由于srt没有标准url定义,所以采用了ffmpeg中对srt url的定义
// Caller 模式
srt://ip:port?mode=caller&latency=125&streamid=test&passphrase=1234567890
// Listener 模式
srt://0.0.0.0:port?mode=listener&latency=125&streamid=test
| URL 组成 | 说明 |
|---|---|
| ip | Listener:0.0.0.0 caller:合法 IP 地址(不能为:0.0.0.0) |
| port | 端口号,有效范围:1 ~ 65535 |
| mode | 模式,有效值:caller/listener |
| latency | 延迟时间,有效范围:20 ~ 8000 |
| passphrase | 加密密码,选填,需要加密时才设置 |
| streamid | 流 ID,字符长度:0 ~ 256 |
7. MPEG-TS over RTP
支持标准的RTP地址
// 组播
rtp://ip:port
// 单播
rtp://0.0.0.0:port
请求示例
POST /api/input/source/add HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: xx
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
"name": "srt test",
"config": {
"type": 1,
"url": "srt://10.10.11.117:9000?mode=caller"
}
}
响应参数
Response Header
| 参数 | 描述 |
|---|---|
| Content-Type | 取值为:'application/json; charset=UTF-8' |
Response Body
| 参数 | 描述 |
|---|---|
| result | 返回码 |
响应示例
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
content-length: 12
{
"result": 0
}