新建直播频道
服务地址
http://api-az-cn.danghongyun.com/rest
请求方法
POST
请求参数
参数 | 说明 | 类型 | 是否必须 |
---|---|---|---|
accessKey | 访问接口的accessKey | String | 必选 |
action | API名称,此接口为 "liveCreateChannel" | String | 必选 |
version | API版本,目前必须为 2.0 | String | 必选 |
signature | 签名,请参考签名规则 | String | 必选 |
timestamp | API调用时间戳,1970年1月1日以来的毫秒数,如 1466488681033 | String | 必选 |
另外在 HTTP 数据包的 body 中以 JSON 的形式传入直播频道创建的参数,将 Http header 中的 Content-Type 设置为 application/json,具 体参数如下:
参数名称 | 是否必须 | 描述 |
name | 是 | String, 频道名称 |
signalType | 是 | String,源流类型 1.推流 2.拉流 |
pullStream | 否 | String,拉流地址,源流类型为拉流时必填 |
liveType | 否 | Integer,直播类型,0.普通直播 2.VR直播 3.进阶直播,不传默认跟随模版类型 |
typeName | 否 | String, 类型名称 |
type | 否 | String, 频道类型(为直播分类id==typeid) |
outputGroupList.protocolType | 是 | Integer,直播输出组协议类型 1.hls 2.rtmp |
outputGroupList.rtmpThirdPartyOutputUrl | 否 | String,第三方推流地址,rtmp协议下可以选填 |
outputGroupList.rotation | 否 | String,画面旋转度数。取值0或90或270 |
outputGroupList.isRecord | 否 | String,是否启用录制,0.不启用 1.启用,默认0 |
outputGroupList.needToMp4 | 否 | String,录制的文件是否转mp4,0.否 1.是,默认0 |
outputGroupList.isTimeShift | 否 | String,是否启用时移,0.不启用 1.启用,默认0。只有HLS协议下才可以启用时移 |
outputGroupList.timeShiftDuration | 否 | String,时移时长,在启用时移的情况下必填(单位小时) |
outputGroupList.isLiveEncrypt | 否 | String,是否启用加密,0.不启用 1.启用,默认0。,只有HLS协议下才可以启用加密 |
outputGroupList.logoId | 否 | String,直播logoId |
outputGroupList.outputTemplateList.templateId | 是 | String,直播模板id |
outputGroupList.outputTemplateList.isDefault | 是 | String,是否默认,0.否 1.是 |
请求示例
{
"name": "added a normal channel to the test",
"signalType": 1,
"liveType": 0,
"outputGroupList": [{
"protocolType": "1",
"isRecord": "1",
"isTimeShift": "1",
"timeShiftDuration": "2",
"isLiveEncrypt": "0",
"logoId": "",
"outputTemplateList": [{
"templateId": "786ee85ebb7c4dad8e75bc836a55a948",
"isDefault": "0"
},
{
"templateId": "6c01632990dc412b911cc7ba0b45885a",
"isDefault": "1"
}]
},
{
"protocolType": "2",
"isRecord": "1",
"outputTemplateList": [{
"templateId": "6c01632990dc412b911cc7ba0b45885a",
"isDefault": "1"
}]
}]
}
响应示例
{
"code": 0,
"message": "operation success",
"result": {
"id": "377fc5664a8a4af189d3cec73aef1d76",
"name": "added a normal channel to the test",
"description": null,
"authCode": "R5CG75",
"type": null,
"typeName": null,
"signalType": "1",
"stream": "p1u0enox_h27zhXg5",
"pullStream": null,
"pullTaskId": null,
"status": 0,
"streamStatus": 2,
"userId": 106,
"streamWidth": null,
"streamHeight": null,
"streamBitrate": null,
"streamAudioBitrate": null,
"streamFrameRate": null,
"createTime": null,
"updateTime": null,
"startTime": null,
"endTime": null,
"autoEndTime": null,
"thumbnailUrl": "http://p1u0enox.images.danghongyun.local/thumbnail/377fc5664a8a4af189d3cec73aef1d76.jpg",
"pushUrl": "rtmp://rtmp-push.danghongyun.dev/live/p1u0enox_h27zhXg5",
"publicPlayUrl": "rtmp://172.17.230.223/live/p1u0enox_h27zhXg5",
"publicFlvPlayUrl": "http://172.17.230.223:1936/live/p1u0enox_h27zhXg5.flv",
"liveType": 0,
"deviceId": null,
"fillInfo": null,
"outputGroupList": [{
"id": "56ddd4ae7657409a8e11e0965d6daac4",
"name": null,
"protocolType": 1,
"channelId": "377fc5664a8a4af189d3cec73aef1d76",
"taskId": null,
"isLiveEncrypt": "0",
"customerId": null,
"contentId": null,
"createTime": null,
"updateTime": null,
"liveLogoId": "",
"liveLogo": null,
"logoId": "",
"rtmpThirdPartyOutputUrl": null,
"isRecord": "1",
"recordTaskId": null,
"recordStartTime": null,
"needToMp4": null,
"isTimeShift": "1",
"timeShiftDuration": "2",
"timeShiftTaskId": null,
"rotation": null,
"outputTemplateList": [{
"templateId": null,
"isDefault": null,
"id": "786ee85ebb7c4dad8e75bc836a55a948",
"displayName": "sd",
"transcodeType": 0,
"videoWidth": 720,
"videoHeight": 576,
"videoBitrate": 450,
"audioBitrate": 64,
"frameRate": 30,
"type": "2",
"userId": null,
"createTime": 3,
"updateTime": null,
"name": "sd/450kbps/720x576"
},
{
"templateId": null,
"isDefault": null,
"id": "6c01632990dc412b911cc7ba0b45885a",
"displayName": "ordinary",
"transcodeType": 0,
"videoWidth": 640,
"videoHeight": 352,
"videoBitrate": 270,
"audioBitrate": 64,
"frameRate": 30,
"type": "2",
"userId": null,
"createTime": 2,
"updateTime": null,
"name": "ordinary/270kbps/640x352"
}],
"liveOutputs": [{
"id": "674651cba44a4d5581b8b30cfce57e2c",
"publicOutputUrl": "http://p1u0enox.live1.danghongyun.local/live/hls/377fc5664a8a4af189d3cec73aef1d76/56ddd4ae7657409a8e11e0965d6daac4.m3u8",
"videoWidth": 720,
"videoHeight": 576,
"videoBitrate": 450,
"audioBitrate": 64,
"protocolType": 1,
"userId": 106,
"channelId": "377fc5664a8a4af189d3cec73aef1d76",
"liveOutputGroupId": "56ddd4ae7657409a8e11e0965d6daac4",
"liveTemplateId": "786ee85ebb7c4dad8e75bc836a55a948",
"createTime": 1542693039000,
"updateTime": null,
"isDefault": "0"
},
{
"id": "74b371f694fe4367b6fada19de172476",
"publicOutputUrl": "http://p1u0enox.live1.danghongyun.local/live/hls/377fc5664a8a4af189d3cec73aef1d76/56ddd4ae7657409a8e11e0965d6daac4.m3u8",
"videoWidth": 640,
"videoHeight": 352,
"videoBitrate": 270,
"audioBitrate": 64,
"protocolType": 1,
"userId": 106,
"channelId": "377fc5664a8a4af189d3cec73aef1d76",
"liveOutputGroupId": "56ddd4ae7657409a8e11e0965d6daac4",
"liveTemplateId": "6c01632990dc412b911cc7ba0b45885a",
"createTime": 1542693039000,
"updateTime": null,
"isDefault": "1"
}]
},
{
"id": "07072e7335e743a8a6d2221ef0f8a1b1",
"name": null,
"protocolType": 2,
"channelId": "377fc5664a8a4af189d3cec73aef1d76",
"taskId": null,
"isLiveEncrypt": null,
"customerId": null,
"contentId": null,
"createTime": null,
"updateTime": null,
"liveLogoId": null,
"liveLogo": null,
"logoId": null,
"rtmpThirdPartyOutputUrl": null,
"isRecord": "1",
"recordTaskId": null,
"recordStartTime": null,
"needToMp4": null,
"isTimeShift": null,
"timeShiftDuration": null,
"timeShiftTaskId": null,
"rotation": null,
"outputTemplateList": [{
"templateId": null,
"isDefault": null,
"id": "6c01632990dc412b911cc7ba0b45885a",
"displayName": "ordinary",
"transcodeType": 0,
"videoWidth": 640,
"videoHeight": 352,
"videoBitrate": 270,
"audioBitrate": 64,
"frameRate": 30,
"type": "2",
"userId": null,
"createTime": 2,
"updateTime": null,
"name": "ordinary/270kbps/640x352"
}],
"liveOutputs": [{
"id": "daeddb298ba543e4a3b323b5d8afee1e",
"publicOutputUrl": "rtmp://172.17.230.223/live/p1u0enox_07072e7335e743a8a6d2221ef0f8a1b1",
"videoWidth": 640,
"videoHeight": 352,
"videoBitrate": 270,
"audioBitrate": 64,
"protocolType": 2,
"userId": 106,
"channelId": "377fc5664a8a4af189d3cec73aef1d76",
"liveOutputGroupId": "07072e7335e743a8a6d2221ef0f8a1b1",
"liveTemplateId": "6c01632990dc412b911cc7ba0b45885a",
"createTime": 1542693039000,
"updateTime": null,
"isDefault": "1"
}]
}]
},
"success": true
}
响应字段说明
参见直播频道信息