查询频道信息
接口描述
1、查询直播频道信息
2、接口URL中的{channelId}为频道号
3、接口支持https协议
接口URL
http://api.polyv.net/live/v2/channels/{channelId}/get
请求方式
GET
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
响应参数描述
data字段描述
channelId
String
直播频道号
userId
String
直播用户ID
name
String
直播频道名称
description
String
直播频道描述
url
String
直播推流地址
stream
String
直播流名称
logoImage
String
播放器logo
logoOpacity
Float
Logo不透明度,1表示完全不透明
logoPosition
String
Logo位置
logoHref
String
Logo的跳转链接
coverImage
String
播放前显示的封面图
coverHref
String
封面图的跳转链接
waitImage
String
等待推流时的显示图片
waitHref
String
等待推流时显示图片的跳转链接
cutoffImage
String
切断流时的显示图片
cutoffHref
String
切断流时显示图片的跳转链接
advertType
String
广告类型
advertDuration
Integer
广告时长
advertWidth
Integer
广告区域宽度
advertHeight
Integer
广告区域高度
advertImage
String
图片广告
advertHref
String
广告的跳转链接
advertFlvVid
String
视频广告ID
advertFlvUrl
String
视频广告链接
playerColor
String
播放器控制栏颜色
autoPlay
Boolean
自动播放
warmUpFlv
String
一开始的暖场视频
passwdRestrict
Boolean
观看密码限制,需要输入观看密码才能播放流
passwdEncrypted
String
观看密码加密后的密文
isOnlyAudio
String
仅推音频流,Y:开启,N:关闭
isLowLatency
String
低延迟,Y:开启,N:关闭
channelLogoImage
String
频道的图标
publisher
String
主持人姓名
scene
String
直播场景 alone:活动直播 topclass:大班课 ppt:三分屏 seminar:研讨会
channelViewerPasswd
String
参与者密码
channelPasswd
String
频道密码
linkMicLimit
Integer
频道连麦人数 -1:使用账号连麦人数 0-16:代表连麦人数
streamType
String
直播方式 client:客户端推流 pull:拉流 thirdpull:第三方拉流 disk:伪直播 audio:音频直播
pureRtcEnabled
String
无延迟直播开关,Y:开启,N:关闭
type
String
频道类型 transmit:发起转播 normal:普通的频道 receive:接收转播
cnAndEnLiveEnabled
String
中英文直播间开关,Y:开启,N:关闭
pushEnUrl
String
英文推流地址
categoryId
String
所属分类Id
categoryName
String
所属分类名称
currentTimeMillis
Long
服务器返回13位毫秒级时间戳
Java请求示例
快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
* 查询频道信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetChannelDetail() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v2/channels/%s/get";
String channelId = "2139283";
url = String.format(url, channelId);
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道信息,返回值:{}", response);
//do somethings
}
响应示例
系统全局错误说明详见全局错误说明
成功示例
{
"code":200,
"status":"success",
"message":"",
"data":{
"channelId":2139283,
"userId":"1b448be323",
"name":"API讨论",
"publisher":"主持人",
"description":"",
"url":"rtmp://push-d1.videocc.net/recordf/1b448be3231612574447801d3db?auth_key=1615187853-0-0-a389e65ee28cdbfe0388cdbba8097ca3",
"stream":"1b448be3231612574447801d3db",
"logoImage":"",
"logoOpacity":1,
"logoPosition":"tr",
"logoHref":"",
"coverImage":"",
"coverHref":"",
"waitImage":"",
"waitHref":"",
"cutoffImage":"",
"cutoffHref":"",
"advertType":"NONE",
"advertDuration":0,
"advertWidth":0,
"advertHeight":0,
"advertImage":"",
"advertHref":"",
"advertFlvVid":"",
"advertFlvUrl":"",
"playerColor":"#666666",
"autoPlay":false,
"warmUpFlv":"",
"passwdRestrict":false,
"passwdEncrypted":"",
"isOnlyAudio":"N",
"isLowLatency":"N",
"m3u8Url":"http://pull-d1.videocc.net/recordf/1b448be3231612574447801d3db.m3u8?auth_key=1615186053-0-0-c9c2c9b09b982e9fe357ecf6461ef532",
"m3u8Url1":"",
"m3u8Url2":"",
"m3u8Url3":"",
"channelLogoImage":"http://liveimages.videocc.net/assets/wimages/pc_images/logo.png",
"scene":"alone",
"channelViewerPasswd":null,
"channelPasswd":"xxxx",
"linkMicLimit":16,
"streamType":"client",
"pureRtcEnabled":"Y",
"type":"transmit",
"cnAndEnLiveEnabled":"N",
"pushEnUrl":null,
"categoryId":340019,
"categoryName":"默认分类",
"currentTimeMillis":1615186053464
}
}
异常示例
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
Last updated
Was this helpful?