接口名称 | 获取点播信息Server 签名 |
地址 | https://api.cnlive.com/open/api2/vod_epg/getVodInfo4Server |
method | post |
返回数据 | json |
/* Title: 1.1 获取点播信息接口 */
http://api.cnlive.com/open/api2/vod_epg/getVodInfo4Server
HTTP GET
参数名 | 参数类型 | 必选 | 参数说明 |
---|---|---|---|
appId | string | true | 应用ID |
vId | string | true | 点播节目标识(直播回放的vId就是创建直播活动时的activityId) |
timestamp | int | true | 精确到秒,当前Unix时间戳,请保证请求服务器时间正确 |
sign | String | true | 签名规则见 签名详情 |
参数名 | 参数类型 | 必选 | 参数说明 |
---|---|---|---|
errorCode | int | true | 错误类型号 |
errorMessage | string | true | 错误类型 |
videoName | string | true | 节目标题 |
subTitle | string | false | 节目副标题 |
desc | string | false | 节目描述 |
categoryName | string | false | 分类名称 |
customCategoryName | string | true | 自定义分类名称 |
tag | string | false | 标签,多个以 逗号分隔 |
videoId | string | true | 节目的唯一标识 |
duration | int | false | 时长,单位 : 毫秒 |
showFileSize | string | false | 文件大小 |
spid | int | false | 所属sp |
institutionName | string | true | 机构名称 |
imginfos | map | false | 图片信息 |
rates | string | ture | 清晰度标识,多个用逗号隔开: 流畅版=1,清晰版=2,高清版=3,超高清=4 |
playUrls | Array | false | 播放url |
返回JSON格式的节目元数据信息,json示例如下:
{
"data":{
"categoryName":"资讯",
"desc":"一带一路特别节目",
"duration":324000,
"imginfos":{
"316*506":"http://test.qnvod.cnlive.com/60/img/2017/0809/ff8080815dc0be57015dc4c1fe380061/000002.jpg?imageView2/1/w/316/h/506",
"112*63":"http://test.qnvod.cnlive.com/60/img/2017/0809/ff8080815dc0be57015dc4c1fe380061/000002.jpg?imageView2/1/w/112/h/63",
"224*126":"http://test.qnvod.cnlive.com/60/img/2017/0809/ff8080815dc0be57015dc4c1fe380061/000002.jpg?imageView2/1/w/224/h/126",
"224*398":"http://test.qnvod.cnlive.com/60/img/2017/0809/ff8080815dc0be57015dc4c1fe380061/000002.jpg?imageView2/1/w/224/h/398",
"485*303":"http://test.qnvod.cnlive.com/60/img/2017/0809/ff8080815dc0be57015dc4c1fe380061/000002.jpg?imageView2/1/w/485/h/303"
},
"institutionName":"阿斯蒂芬村",
"rates":"1,2",
"showFileSize":418501536,
"spid":60,
"subTitle":"",
"tag":"丝绸之路,一带一路,文化交流,中华文化",
"videoId":"17cbfede6f074db18d06fdeb170e41c4",
"videoName":"大道之行一带一路",
"playUrls":[
{
"rate":2,
"fmt":"hls",
"url":"http://xxx.m3u8"
},
{
"rate":2,
"fmt":"mp4",
"url":"http://xxx.mp4"
}
]
},
"errorCode":0,
"errorMessage":"sucess"
}
public Object getVodUrl() {
String result = "";
Map params = new HashMap<>();
params.put("appId", "60_iqj730vn11");
params.put("vId", "174e6c5f3d9e4ddeb739feed1906fa11");
params.put("timestamp", System.currentTimeMillis()/1000+"");
String url = OpenUtil.buildURL("http://api.cnlive.com/open/api/dianbo/getVodInfo4Server", params, "appId对应key值");
HttpURLConnection connection;
try {
URL requestUrl = new URL(url);
connection = (HttpURLConnection)requestUrl.openConnection();
connection.setRequestMethod("GET");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.connect();//连接
//获得返回值
if(connection.getResponseCode() == HttpURLConnection.HTTP_OK){
InputStream in = connection.getInputStream();
String currentLine = "";
if(in != null){
BufferedReader br = new BufferedReader(new InputStreamReader(in,"utf-8"));
while((currentLine = br.readLine()) != null){
result += currentLine;
}
br.close();
}
}
}catch (Exception e) {
e.printStackTrace();
}
if(BaseUtil.notBlank(result)) {
JSONObject resultJson = JSONObject.parseObject(result);
return resultJson
}
return "";
}