音视频服务器API
创建音视频房间
请求说明
POST https://api.netease.im/nimserver/nrtc/createChannel.action HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
接口描述
创建一个音视频房间,可以创建一个IM版音视频房间
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
type | int | 是 | 0表示IM音视频 |
channelName | String | 是 | 房间名称,应用内唯一 |
accid | String | 否 | IM音视频需要这个参数,表示房间创建者 |
webrtc | int | 否 | 是否支持webrtc,0表示不支持,1表示支持 |
selfconfig | string | 否 | 表示自定义字段 |
roomconfig | String | 否 | 房间属性,目前支持配置房间推流相关信息,可以转成JSON格式 |
curl请求示例
curl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'type=0&channelName=xxx&accid=abc' 'https://api.netease.im/nimserver/nrtc/createChannel.action'
返回说明
http 响应:json
"Content-Type": "application/json; charset=utf-8"
{
"code": 200,
"cid": 12345 //房间id
}
房间属性说明
{
"rtmpTasks": [//推流参数配置
{
"taskId": "stream_1", //推流任务ID,string格式。taskId为推流任务的唯一标识,用于过程中增删任务操作
"streamUrl": "rtmp://test.url", //推流地址
"layoutMode": "M-0", //连麦方式
"layoutPara": "{\"k1\": \"v1\"}", //自定义布局参数,json string格式
"record": true, //录制开关
"accid": "abc" //选填,指定大画面accid
}
]
}
注意:关于房间推流任务参数的详细的填写规则,可登录网易云信业务后台,进入应用-功能管理-互动直播-功能配置-互动直播房间推流参数配置界面进行参数配置,并作参考
主要的返回码
200、403、414、416、417、500
具体请参考code状态表
增加一个房间推流任务
请求说明
POST https://api.netease.im/nimserver/nrtc/addRtmpTask.action HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
接口描述
增加一个房间推流任务
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
channelName | String | 是 | 房间名称,应用内唯一 |
type | int | 是 | 0表示IM音视频 |
task | String | 是 | 房间推流JSON |
curl请求示例
curl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'type=0&channelName=xxx&task={"taskId":"stream_1","streamUrl":"rtmp://test.url","layoutMode":"M-0","record":true}' 'https://api.netease.im/nimserver/nrtc/addRtmpTask.action'
返回说明
http 响应:json
"Content-Type": "application/json; charset=utf-8"
{
"code": 200,
"cid": 12345 //房间id
}
房间推流JSON格式
{
"taskId": "stream_1", //推流任务ID,string格式。taskId为推流任务的唯一标识
"streamUrl": "rtmp://test.url", //推流地址
"layoutMode": "M-0", //连麦方式
"layoutPara": "{\"k1\": \"v1\"}", //自定义布局参数,json string格式
"record": true, //录制开关
"accid": "abc" //选填,指定大画面accid
}
主要的返回码
200、403、404、414、416、500
具体请参考code状态表
删除一个房间推流任务
请求说明
POST https://api.netease.im/nimserver/nrtc/removeRtmpTask.action HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
channelName | String | 是 | 房间名称,应用内唯一 |
type | int | 是 | 0表示IM音视频 |
taskId | String | 是 | 房间推流id |
curl请求示例
curl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'type=0&channelName=xxx&taskId=xxxx' 'https://api.netease.im/nimserver/nrtc/removeRtmpTask.action'
返回说明
http 响应:json
"Content-Type": "application/json; charset=utf-8"
{
"code": 200
}
主要的返回码
200、403、404、414、416、500
具体请参考code状态表
查询单个房间推流任务
请求说明
POST https://api.netease.im/nimserver/nrtc/getRtmpTask.action HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
channelName | String | 是 | 房间名称,应用内唯一 |
type | int | 是 | 0表示IM音视频 |
taskId | String | 是 | 房间推流id |
curl请求示例
curl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'type=0&channelName=xxx&taskId=xxxx' 'https://api.netease.im/nimserver/nrtc/getRtmpTask.action'
返回说明
http 响应:json
"Content-Type": "application/json; charset=utf-8"
{
"code" : 200, //必填,200-成功,400-客户请求错误,500-服务器内部错误
"status" : "active", //任务状态, deleted为已被删除, active为活跃
"cid":122333,
"rtmpTask": {
"taskId": "stream_1", //推流任务ID,string格式
"streamUrl": "rtmp://test.url", //推流地址
"layoutMode": "M-0", //连麦方式
"layoutPara": {}, //layout参数,json格式
"record": true, //录制开关
"accid": "abc" //accid
}
}
主要的返回码
200、403、404、414、416、500
具体请参考code状态表
查询房间推流任务列表
请求说明
POST https://api.netease.im/nimserver/nrtc/getRtmpTaskList.action HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
channelName | String | 是 | 房间名称,应用内唯一 |
type | int | 是 | 0表示IM音视频 |
curl请求示例
curl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'type=0&channelName=xxx' 'https://api.netease.im/nimserver/nrtc/getRtmpTaskList.action'
返回说明
http 响应:json
"Content-Type": "application/json; charset=utf-8"
{
"code" : 200, //必填,200-成功,400-客户请求错误,500-服务器内部错误
"cid":122333,
"errmsg" : "invalid params", //选填,失败时返回的错误信息
"rtmpTasks": [{
"taskId": "stream_1", //推流任务ID,string格式
"streamUrl": "rtmp://test.url", //推流地址
"layoutMode": "M-0", //连麦方式
"layoutPara": {}, //layout参数,json格式
"record": true, //录制开关
"accid": "abc" //accid
}]
}
主要的返回码
200、403、404、414、416、500
具体请参考code状态表
更新房间推流任务
请求说明
POST https://api.netease.im/nimserver/nrtc/updateRtmpTask.action HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
channelName | String | 是 | 房间名称,应用内唯一 |
type | int | 是 | 0表示IM音视频 |
ope | int | 是 | 1表示更新,2表示删除 |
opeJson | json | 是 | 更新或者删除的字段内容 |
curl请求示例
curl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'type=0&channelName=xxx&ope=2&opeJson={"taskId":"xxx","fields":["xx"]}' 'https://api.netease.im/nimserver/nrtc/updateRtmpTask.action'
更新时的opeJson格式
{
"taskId" : "stream_1", //推流任务ID,string格式
"streamUrl": "rtmp://test.url", //推流地址
"layoutMode": "M-0", //连麦方式
"layoutPara":"{}", //layout参数,json格式的字符串
"record":true, //录制开关
"accid": "abc" //选填,指定uid,IM版是accid
}
删除时的opeJson格式
{
"taskId" : "stream_1", //推流任务ID,string格式
"fields": ["accid", "k1", "k2"] //要删除的字段
}
返回说明
http 响应:json
"Content-Type": "application/json; charset=utf-8"
{
"code" : 200, //必填,200-成功,400-客户请求错误,500-服务器内部错误
"cid":122333
}
主要的返回码
200、403、404、414、416、500
具体请参考code状态表
根据cid查询录制文件信息
请求说明
POST https://api.netease.im/nimserver/history/queryMediaFileByChannelId.action HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=utf-8
请求中Headers的设置请参考接口概述
备注:此接口受频控限制,1分钟最多调用60次,建议用户开通录制文件抄送功能来维护录制文件信息,本接口仅作为抄送异常时的补偿手段
参数说明
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
channelId | Long | 是 | 通道号 |
curl请求示例
curl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigwow323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'channelId=123' 'https://api.netease.im/nimserver/history/queryMediaFileByChannelId.action'
返回说明
http 响应:json
"Content-Type": "application/json; charset=utf-8"
{
"code": 200,
"fileInfos": [
{
"createTime": 1587718829022,
"objectName": "123-22222222-1589020209203-0.mp4",
"url": "http://vod9abc.nosdn.127.net/123-22222222-1589020209203-0.mp4"
},
{
"createTime": 1587718828946,
"objectName": "0-22222222-1589020209203-0-mix.mp4",
"url": "http://vod9abc.nosdn.127.net/0-22222222-1589020209203-0-mix.mp4"
}
],
"channelId": 52026368004000
}
主要的返回码
200、403、404、414、416、500
具体请参考code状态表
本篇文档内容是否对您有帮助?
有帮助
我要吐槽
此文档对你是否有帮助
×
有帮助
我要吐槽
×