跳到主要内容

新建直播频道

服务地址

http://api-az-cn.danghongyun.com/rest

请求方法

POST

请求参数

参数说明类型是否必须
accessKey访问接口的accessKeyString必选
actionAPI名称,此接口为 "liveCreateChannel"String必选
versionAPI版本,目前必须为 2.0String必选
signature签名,请参考签名规则String必选
timestampAPI调用时间戳,1970年1月1日以来的毫秒数,如 1466488681033String必选

另外在 HTTP 数据包的 body 中以 JSON 的形式传入直播频道创建的参数,将 Http header 中的 Content-Type 设置为 application/json,具体参数如下:

参数名称是否必须描述
nameString, 频道名称
signalTypeString,源流类型 1.推流 2.拉流
pullStreamString,拉流地址,源流类型为拉流时必填
liveTypeInteger,直播类型,0.普通直播 2.VR直播 3.进阶直播,不传默认跟随模版类型
typeNameString, 类型名称
typeString, 频道类型(为直播分类id==typeid)
outputGroupList.protocolTypeInteger,直播输出组协议类型 1.hls 2.rtmp
outputGroupList.rtmpThirdPartyOutputUrlString,第三方推流地址,rtmp协议下可以选填
outputGroupList.rotationString,画面旋转度数。取值0或90或270
outputGroupList.isRecordString,是否启用录制,0.不启用 1.启用,默认0
outputGroupList.needToMp4String,录制的文件是否转mp4,0.否 1.是,默认0
outputGroupList.isTimeShiftString,是否启用时移,0.不启用 1.启用,默认0。只有HLS协议下才可以启用时移
outputGroupList.timeShiftDurationString,时移时长,在启用时移的情况下必填(单位小时)
outputGroupList.isLiveEncryptString,是否启用加密,0.不启用 1.启用,默认0。,只有HLS协议下才可以启用加密
outputGroupList.logoIdString,直播logoId
outputGroupList.outputTemplateList.templateIdString,直播模板id
outputGroupList.outputTemplateList.isDefaultString,是否默认,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
}

响应字段说明

参见直播频道信息