Commit f658443f255c286b414fcb45fc3c1ce52f3b0a23

Authored by 刘炯
1 parent e30d78bb

新建内容库云节点

12.内容库云/1.0 内容库查询接口.md 0 → 100644
  1 +/*
  2 +Title: 1.1 获取点播信息接口
  3 +*/
  4 +
  5 +### 接口描述 ###
  6 +
  7 +
  8 +### 接口地址 ###
  9 +http://api.cnlive.com/open/api2/vod_epg/getVodInfo4Server
  10 +
  11 +### 接口协议 ###
  12 +HTTP GET
  13 +
  14 +### 接口请求参数 ###
  15 +|参数名| 参数类型 | 必选 | 参数说明 |
  16 +|:----- | :------: | :------: | :------: |
  17 +|appId| string | true | 应用ID |
  18 +|vId| string | true | 点播节目标识(直播回放的vId就是创建直播活动时的activityId) |
  19 +|timestamp| int | true | 精确到秒,当前Unix时间戳,请保证请求服务器时间正确 |
  20 +|sign| String | true | 签名规则见 [签名详情] (http://help.open.cnlive.com/common.html) |
  21 +
  22 +### 返回值 ###
  23 +
  24 +| 参数名 | 参数类型 | 必选 | 参数说明 |
  25 +| :-----------| :------: | :------: | :------: |
  26 +| errorCode| int | true | 错误类型号 |
  27 +| errorMessage| string | true | 错误类型 |
  28 +| videoName| string | true | 节目标题 |
  29 +| subTitle| string | false | 节目副标题 |
  30 +| desc| string | false | 节目描述 |
  31 +| categoryName| string | false | 分类名称 |
  32 +| customCategoryName| string | true | 自定义分类名称 |
  33 +| tag| string | false | 标签,多个以 逗号分隔 |
  34 +| videoId| string | true | 节目的唯一标识 |
  35 +| duration| int | false | 时长,单位 : 毫秒 |
  36 +| showFileSize| string | false | 文件大小 |
  37 +| spid| int | false | 所属sp |
  38 +| institutionName| string | true | 机构名称 |
  39 +| imginfos| map | false | 图片信息|
  40 +| rates | string | ture |清晰度标识,多个用逗号隔开: 流畅版=1,清晰版=2,高清版=3,超高清=4 |
  41 +| playUrls| Array | false | 播放url|
  42 +
  43 +返回JSON格式的节目元数据信息,json示例如下:
  44 +
  45 +``` json
  46 +{
  47 + "data":{
  48 + "categoryName":"资讯",
  49 + "desc":"一带一路特别节目",
  50 + "duration":324000,
  51 + "imginfos":{
  52 + "316*506":"http://test.qnvod.cnlive.com/60/img/2017/0809/ff8080815dc0be57015dc4c1fe380061/000002.jpg?imageView2/1/w/316/h/506",
  53 + "112*63":"http://test.qnvod.cnlive.com/60/img/2017/0809/ff8080815dc0be57015dc4c1fe380061/000002.jpg?imageView2/1/w/112/h/63",
  54 + "224*126":"http://test.qnvod.cnlive.com/60/img/2017/0809/ff8080815dc0be57015dc4c1fe380061/000002.jpg?imageView2/1/w/224/h/126",
  55 + "224*398":"http://test.qnvod.cnlive.com/60/img/2017/0809/ff8080815dc0be57015dc4c1fe380061/000002.jpg?imageView2/1/w/224/h/398",
  56 + "485*303":"http://test.qnvod.cnlive.com/60/img/2017/0809/ff8080815dc0be57015dc4c1fe380061/000002.jpg?imageView2/1/w/485/h/303"
  57 + },
  58 + "institutionName":"阿斯蒂芬村",
  59 + "rates":"1,2",
  60 + "showFileSize":418501536,
  61 + "spid":60,
  62 + "subTitle":"",
  63 + "tag":"丝绸之路,一带一路,文化交流,中华文化",
  64 + "videoId":"17cbfede6f074db18d06fdeb170e41c4",
  65 + "videoName":"大道之行一带一路",
  66 + "playUrls":[
  67 + {
  68 + "rate":2,
  69 + "fmt":"hls",
  70 + "url":"http://xxx.m3u8"
  71 + },
  72 + {
  73 + "rate":2,
  74 + "fmt":"mp4",
  75 + "url":"http://xxx.mp4"
  76 + }
  77 + ]
  78 + },
  79 + "errorCode":0,
  80 + "errorMessage":"sucess"
  81 +}
  82 +```
  83 +#### java 示例
  84 +
  85 +```java
  86 +public Object getVodUrl() {
  87 + String result = "";
  88 + Map params = new HashMap<>();
  89 + params.put("appId", "60_iqj730vn11");
  90 + params.put("vId", "174e6c5f3d9e4ddeb739feed1906fa11");
  91 + params.put("timestamp", System.currentTimeMillis()/1000+"");
  92 + String url = OpenUtil.buildURL("http://api.cnlive.com/open/api/dianbo/getVodInfo4Server", params, "appId对应key值");
  93 + HttpURLConnection connection;
  94 + try {
  95 + URL requestUrl = new URL(url);
  96 + connection = (HttpURLConnection)requestUrl.openConnection();
  97 + connection.setRequestMethod("GET");
  98 + connection.setDoInput(true);
  99 + connection.setDoOutput(true);
  100 + connection.connect();//连接
  101 +
  102 + //获得返回值
  103 + if(connection.getResponseCode() == HttpURLConnection.HTTP_OK){
  104 + InputStream in = connection.getInputStream();
  105 + String currentLine = "";
  106 + if(in != null){
  107 + BufferedReader br = new BufferedReader(new InputStreamReader(in,"utf-8"));
  108 + while((currentLine = br.readLine()) != null){
  109 + result += currentLine;
  110 + }
  111 + br.close();
  112 + }
  113 + }
  114 + }catch (Exception e) {
  115 + e.printStackTrace();
  116 + }
  117 +
  118 + if(BaseUtil.notBlank(result)) {
  119 + JSONObject resultJson = JSONObject.parseObject(result);
  120 + return resultJson
  121 + }
  122 +
  123 + return "";
  124 + }
  125 +```
0 \ No newline at end of file 126 \ No newline at end of file