add-channel-sink接口
添加输出视频流,支持类型如下:
- RTMP/RTMPS
 
- SRT Listener
 
- SRT Caller
 
仅管理员有权限。
接口原型
    | 协议 | 
    HTTP/HTTPS POST | 
    | URL | 
    ip[:port]/sc_cloud/channel/add-sink | 
    | 数据格式 | 
    请求消息:Content-Type: application/json 响应消息:Content-Type: application/json | 
请求Cookies
| 名称 | 
描述 | 
| mwcloud-sid | 
用于标识当前登录的字符串 | 
| mwcloud-uid | 
当前登录用户名 | 
Request Body
protocol
rtmp
| 参数 | 
描述 | 
| type | 
常量值:1。 | 
| url | 
服务器地址。 | 
| key | 
流密钥。 | 
| is-auth | 
认证状态。 | 
| user | 
用户名。 | 
| passwd | 
密码。 | 
srt
| 参数 | 
描述 | 
| ip | 
IP地址或域名。type为SRT Listener时,IP为常量值:"0.0.0.0"。 | 
| port | 
端口号,取值范围是1~65535。 | 
| latency | 
延迟时间。取值范围是20ms~8000ms,默认为120ms。 | 
| bandwidth | 
SRT开销占总带宽的比例。取值范围是5%~100%,默认值为25%。 仅SRT Caller类型有此属性。 | 
| stream-id | 
流ID。 仅SRT Caller类型有此属性。 取值范围是0~256个字符。必须与发送端的Stream ID一致。 | 
| enc-type | 
加密类型,默认不加密。取值对应关系如下:- 0:不使用加密 
 - 16:AES-128
 - 24:AES-192 
 - 32:AES-256 
 
  | 
| enc-pass | 
加密密码。enc-type取值不为0时,需要输入10~79位字符的密码。 | 
请求示例
POST /sc_cloud/channel/add-sink HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: 190
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
  "id": 13,
  "protocol": {
    "name": "output-rtmp",
    "is-enable": 1,
    "type": 1,
    "rtmp": {
      "type": 1,
      "url": "rtmp://10.2.3.63/live",
      "key": "",
      "is-auth": 1,
      "user": "test",
      "passwd": "12345678",
      "name": "output-rtmp"
    }
  }
}
POST /sc_cloud/channel/add-sink HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: 225
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
  "id": 13,
  "protocol": {
    "name": "output-srt caller",
    "is-enable": 1,
    "type": 2,
    "srt": {
      "ip": "10.0.2.3",
      "port": 678,
      "latency": 120,
      "enc-type": 16,
      "enc-pass": "passphrase",
      "stream-id": "stream id",
      "bandwidth": 25,
      "name": "output-srt caller"
    }
  }
}
POST /sc_cloud/channel/add-sink HTTP/1.1
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: 178
Cookie: mwcloud-sid=OCXWUMGEYPGIAWWOETYXPNMVHDZIAZJP; mwcloud-uid=Admin;
{
  "id": 13,
  "protocol": {
    "name": "output-srt listener",
    "is-enable": 1,
    "type": 3,
    "srt": {
      "ip": "0.0.0.0",
      "port": 666,
      "latency": 120,
      "enc-type": 0,
      "enc-pass": "",
      "name": "output-srt listener"
    }
  }
}
响应参数
| 参数 | 
描述 | 
| Content-Type | 
取值为:'application/json; charset=UTF-8' | 
Response Body
| 参数 | 
描述 | 
| result | 
返回码。 | 
| method | 
方法名:add-channel-sink。 | 
响应示例
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 40
Connection: keep-alive
{
  "method": "add-channel-sink",
  "result": 0
}