/api/channel/add
添加通道。
需要通道编辑权限
接口原型
协议 |
HTTP/HTTPS POST |
URL |
ip[:port]/api/channel/add |
数据格式 |
请求消息:Content-Type: application/json 响应消息:Content-Type: application/json |
请求Cookies
名称 |
描述 |
mwcloud-sid |
用于标识当前登录的字符串 |
mwcloud-uid |
当前登录用户名 |
Request Body
参数 |
描述 |
name |
名称 |
config |
配置,通道配置 |
通道配置
参数 |
描述 |
ndi |
ndi输出流配置ndi输出配置 |
play-key |
播放key,全局唯一,最大长度256字节 |
push-key |
推流key,与播放key不能一致,并且全局唯一,最大长度256字节 |
ndi输出配置
参数 |
描述 |
enable |
ndi输出流配置 |
transport-mode |
传输类型,(单播-0, 组播-1, rudp-2, multi-tcp-3) |
mcast-ip |
组播地址 |
mcast-sub-mask |
组播掩码 |
mcast-time-to-live |
组播生存时间 |
group |
ndi输出所属组 |
请求示例
POST /api/channel/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":"test2",
"config": {
"ndi":{
"enable":true,
"transport-mode":1,
"mcast-ip":"239.255.0.0",
"mcast-sub-mask":"255.255.0.0",
"mcast-time-to-live":"1",
"group":"public"
},
"play-key": "test1",
"push-key": "push_test2",
"protocol": {
"prefer": 1,
"ndihx": true,
"rtmp": true,
"srt": true
}
}
}
响应参数
参数 |
描述 |
Content-Type |
取值为:'application/json; charset=UTF-8' |
Response Body
响应示例
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
content-length: xx
{
"result": 0
}