批量查询频道单个回放信息
接口描述
1、根据多个频道号查询每个频道设置的回放视频信息(仅支持非直播暂存的单个视频的回放查询)
2、接口支持https协议
接口URL
http://api.polyv.net/live/v4/channel/play-back/get
请求方式
GET
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
2、仅支持非直播暂存的单个视频的回放查询,否则返回数据为null
请求参数描述
示例
http://api.polyv.net/live/v4/channel/play-back/get?appId=frlr1zazn3&sign=5CE29DB9BDF1C24F85B096C38B9156B8&channelIds=1965681%2C2722361×tamp=1639717803069
响应参数描述
Error参数描述
参数名
类型
说明
code
Integer
错误代码,用于确定具体的错误原因
desc
String
错误描述,与 error.code 对应
data参数描述
参数名
类型
说明
channelId
Integer
频道ID
vid
String
点播系统VID(常用该字段)
videoId
String
直播系统生成的id (不常用,视频库中的回放视频)
videoPoolId
String
点播视频videoPoolId (不常用)
videoName
String
视频名称
firstImg
String
视频首图
duration
String
视频时间,如:05:15:01
Java请求示例
快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。
/**
* 批量查询频道单个回放信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testPlaybackVideoInfoList() 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/v4/channel/play-back/get";
String categoryIds="340019,345134";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelIds", "1965681,2722361");
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试批量查询频道单个回放信息,返回值:{}", response);
//do somethings
}
响应示例
系统全局错误说明详见全局错误说明
成功示例
{
"code": 200,
"status": "success",
"requestId": "f4b2f18c-f8f6-41f0-b0c8-9eef00af4fba",
"data": [
{
"channelId": 2722361,
"videoId": null,
"videoPoolId": null,
"videoName": null,
"firstImg": null,
"duration": null,
"vid": null
},
{
"channelId": 1965681,
"videoId": "8073e37567",
"videoPoolId": "1b448be323a9076c9941604ac1c667f9",
"videoName": "Junit测试(勿删)",
"firstImg": "//doc.polyv.net/images/default/blackboard.png",
"duration": "05:15:01",
"vid": "1b448be323a9076c9941604ac1c667f9_1"
}
],
"success": true
}
异常示例
{
"code": 400,
"status": "error",
"requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360831818611581",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
Last updated
Was this helpful?