Commit e07ad0a2d8c2ba3d64a7696cad5c0a80a7f2f665
1 parent
2a5a66d2
播放器获取EPG信息接口
Showing
1 changed file
with
104 additions
and
0 deletions
01.点播云/1.01 播放器获取EPG信息接口.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 | +| title| string | true | 节目标题 | | |
| 29 | +| subTitle| string | false | 节目副标题 | | |
| 30 | +| description| string | false | 节目描述 | | |
| 31 | +| createTime| string | true | 创建时间,格式:yyyyMMddHHmmss | | |
| 32 | +| publishTime| string | true | 发布时间,格式:yyyyMMddHHmmss | | |
| 33 | +| status| string | true | 节目状态,0:待发布,1:已发布,2:下线 | | |
| 34 | +| vId| string | true | 节目的唯一标识 | | |
| 35 | +| packagePomID| string | false | 节目的产品包ID | | |
| 36 | +| onePomID| string | false | 节目的产品ID | | |
| 37 | +| freePlayLength| string | false | 免费播放时长,单位 s,默认 60 | | |
| 38 | +| rates | string | ture |清晰度标识,多个用逗号隔开: 流畅版=1,清晰版=2,高清版=3,超高清=4 | | |
| 39 | + | |
| 40 | +返回JSON格式的节目元数据信息,json示例如下: | |
| 41 | + | |
| 42 | +``` json | |
| 43 | +{ | |
| 44 | + "errorMessage":"请求成功", | |
| 45 | + "data":{ | |
| 46 | + "createTime":"20160808125905", | |
| 47 | + "publishTime":"20160808131657", | |
| 48 | + "status":"1", | |
| 49 | + "vId":"174e6c5f3d9e4ddeb739feed1906fa11", | |
| 50 | + "vipFlag":"0", | |
| 51 | + "packagePomID":"3_ent/xingwenrebao/yuleqianxian/", | |
| 52 | + "subTitle":"BTOB对粉丝甜喊:我想你们了", | |
| 53 | + "title":"BTOB甜喊:我想你们了", | |
| 54 | + "description":"@TV娱乐前线:韩国男团BTOB近日在台北国际会议中心举行演唱会。", | |
| 55 | + "freePlayLength":"60", | |
| 56 | + "rates":"1,2,3", | |
| 57 | + "onePomID":"3_174e6c5f3d9e4ddeb739feed1906fa11" | |
| 58 | + }, | |
| 59 | + "errorCode":"0" | |
| 60 | +} | |
| 61 | +``` | |
| 62 | +#### java 示例 | |
| 63 | + | |
| 64 | +```java | |
| 65 | +public Object getVodUrl() { | |
| 66 | + String result = ""; | |
| 67 | + Map params = new HashMap<>(); | |
| 68 | + params.put("appId", "60_iqj730vn11"); | |
| 69 | + params.put("vId", "174e6c5f3d9e4ddeb739feed1906fa11"); | |
| 70 | + params.put("timestamp", System.currentTimeMillis()/1000+""); | |
| 71 | + String url = OpenUtil.buildURL("http://api.cnlive.com/open/api/dianbo/getVodInfo4Server", params, "appId对应key值"); | |
| 72 | + HttpURLConnection connection; | |
| 73 | + try { | |
| 74 | + URL requestUrl = new URL(url); | |
| 75 | + connection = (HttpURLConnection)requestUrl.openConnection(); | |
| 76 | + connection.setRequestMethod("GET"); | |
| 77 | + connection.setDoInput(true); | |
| 78 | + connection.setDoOutput(true); | |
| 79 | + connection.connect();//连接 | |
| 80 | + | |
| 81 | + //获得返回值 | |
| 82 | + if(connection.getResponseCode() == HttpURLConnection.HTTP_OK){ | |
| 83 | + InputStream in = connection.getInputStream(); | |
| 84 | + String currentLine = ""; | |
| 85 | + if(in != null){ | |
| 86 | + BufferedReader br = new BufferedReader(new InputStreamReader(in,"utf-8")); | |
| 87 | + while((currentLine = br.readLine()) != null){ | |
| 88 | + result += currentLine; | |
| 89 | + } | |
| 90 | + br.close(); | |
| 91 | + } | |
| 92 | + } | |
| 93 | + }catch (Exception e) { | |
| 94 | + e.printStackTrace(); | |
| 95 | + } | |
| 96 | + | |
| 97 | + if(BaseUtil.notBlank(result)) { | |
| 98 | + JSONObject resultJson = JSONObject.parseObject(result); | |
| 99 | + return resultJson | |
| 100 | + } | |
| 101 | + | |
| 102 | + return ""; | |
| 103 | + } | |
| 104 | +``` | |
| 0 | 105 | \ No newline at end of file | ... | ... |