Commit f1231dd3a740a7f8a2f0a18257fea3a254a5a7fa

Authored by 翁力
1 parent 78b208bb

add live

02.直播云/1.1 获取直播活动信息接口.md 0 → 100644
  1 +/*
  2 +Title: 1.1 获取某直播活动信息接口
  3 +*/
  4 +
  5 +### 接口描述 ###
  6 +
  7 +
  8 +### 接口地址 ###
  9 +http://api.cnlive.com/open/api2/zbsc/getLiveActivityPlayInfo
  10 +
  11 +### 接口协议 ###
  12 +HTTP GET
  13 +
  14 +### 接口请求参数 ###
  15 +| 参数名 | 参数类型 | 必选 | 参数说明 |
  16 +| :----------- | :------: | :------: | :------: |
  17 +| sp_id | string | true | 应用ID |
  18 +| activityId| string | true | 由开发者通过API创建接口或者在直播云管理端创建,保证唯一性 |
  19 +| timestamp | int | true | 精确到秒,当前Unix时间戳,请保证请求服务器时间正确 |
  20 +| sign | String | true | 签名规则见 [签名详情] (http://help.open.cnlive.com/common.html) |
  21 +
  22 +
  23 +### 返回值 ###
  24 +
  25 +| 参数名 | 参数类型 | 必选 | 参数说明 |
  26 +| :----------- | :------: | :------: | :------: |
  27 +| errorCode | int | true | 错误类型号 |
  28 +| message| string | true | 错误类型 |
  29 +| activityid| string | true | 活动ID,确保SP下的唯一性 |
  30 +| activityname | string | true | 活动名称 |
  31 +| activitystatus | int | true | 活动状态,0:未开始 /1:已开始 /3:已结束 /4 已下线,默认为0 |
  32 +| isHorizontalScreen | int | true | 屏幕方向,0:垂直即竖屏 /1:水平即横屏 ,默认为1 |
  33 +| channelID | string | true | 播放通道;PGC业务:平台分配/ UGC业务:主播ID生成,确保SP下的唯一性 |
  34 +| createTime | string | false | 开始时间,格式yyyyMMddHHmmss |
  35 +| startTime | string | false | 开始时间,格式yyyyMMddHHmmss |
  36 +| endTime | string | false | 开始时间,格式yyyyMMddHHmmss |
  37 +| coverImgUrl | string | false | 活动封面 |
  38 +| activityCategory | string | false | 活动分类ID,001 发布会/002 婚礼/003 年会 /004 体育/005 游戏/006 旅游&户外/007 财经/008 演唱会/009 烹饪/010 宠物&动物/011 访谈/012 教育/013 竞技/014 剧场/015 晚会/016 电视节目/017 秀场 |
  39 +| extensions | string | false | 扩展字段,参数格式为Map对象的Json字符串 (主播昵称、头像等等) |
  40 +| mp4_url_rate1 | string | false |流畅版的rtmp播放地址 |
  41 +| mp4_url_rate2 | string | true | 标清版的rtmp播放地址,必须有|
  42 +| mp4_url_rate3 | string | false | 高清版的rtmp播放地址 |
  43 +| mp4_url_rate4 | string | false | 超清版的rtmp播放地址 |
  44 +| hls_url_rate1 | string | false |流畅版的m3u8播放地址 |
  45 +| hls_url_rate2 | string | true | 标清版的m3u8播放地址,必须有|
  46 +| hls_url_rate3 | string | false | 高清版的m3u8播放地址 |
  47 +| hls_url_rate4 | string | false | 超清版的m3u8播放地址 |
  48 +| extViews | 对象数组 | false | 扩展机位的播放信息(不含主画面PGM的播放信息) |
  49 +
  50 +返回JSON格式的节目元数据信息,json示例如下:
  51 +
  52 +``` json
  53 +{
  54 + "errorCode":"0",
  55 + "messagae":"请求成功",
  56 + "data"{
  57 + "activityid":"xxxxx",
  58 + "activitystatus":"1",
  59 + "activityname":"测试活动",
  60 + "coverImgUrl":"小图图片URL",
  61 + “isHorizontalScreen”:“1”,
  62 + “channelID”:“xinyingshi”,
  63 + “startTime”:“”,
  64 + “endTime”:“”,
  65 + “createTime”:“”,
  66 + “extensions”:“”,
  67 + “activityCategory”:“”,
  68 + "mp4_url_rate1":"",
  69 + "mp4_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplayBySWF?channelID=xinyingshi&rate=2&sp_id=iqhpk8pl19",
  70 + "mp4_url_rate3":"",
  71 + "mp4_url_rate4":"",
  72 + "hls_url_rate1":"",
  73 + "hls_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplay?channelID=xinyingshi&rate=2&sp_id=iqhpk8pl19",
  74 + "hls_url_rate3":"",
  75 + "hls_url_rate4":"",
  76 + "extViews"[
  77 + {
  78 + "mp4_url_rate1":"",
  79 + "mp4_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplayBySWF?channelID=xinyingshi_m1&rate=2&sp_id=iqhpk8pl19",
  80 + "mp4_url_rate3":"",
  81 + "mp4_url_rate4":"",
  82 + "hls_url_rate1":"",
  83 + "hls_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplay?channelID=xinyingshi_m1&rate=2&sp_id=iqhpk8pl19",
  84 + "hls_url_rate3":"",
  85 + "hls_url_rate4":""
  86 + },
  87 + {
  88 + "mp4_url_rate1":"",
  89 + "mp4_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplayBySWF?channelID=xinyingshi_m2&rate=2&sp_id=iqhpk8pl19",
  90 + "mp4_url_rate3":"",
  91 + "mp4_url_rate4":"",
  92 + "hls_url_rate1":"",
  93 + "hls_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplay?channelID=xinyingshi_m2&rate=2&sp_id=iqhpk8pl19",
  94 + "hls_url_rate3":"",
  95 + "hls_url_rate4":""
  96 + }
  97 + ]
  98 + }
  99 +}
  100 +```
  101 +
  102 +
  103 +
  104 +``` java
  105 +public String getPlayInfo() {
  106 + String result = "";
  107 + Map params = new HashMap<>();
  108 + params.put("sp_id", "iqhpk8pl19");
  109 + params.put("customID", "d849bb4277be42799df3ffc21654d949");
  110 + params.put("timestamp", System.currentTimeMillis()/1000+"");
  111 + String url = OpenUtil.buildURL("http://api.cnlive.com/open/api2/zbsc/getLiveActivityPlayInfo", params, "672db30805f848f59ec3728f8347a4a0");
  112 + HttpURLConnection connection;
  113 + try {
  114 + URL requestUrl = new URL(url);
  115 + connection = (HttpURLConnection)requestUrl.openConnection();
  116 + connection.setRequestMethod("GET");
  117 + connection.setDoInput(true);
  118 + connection.setDoOutput(true);
  119 + connection.connect();//连接
  120 +
  121 + //获得返回值
  122 + if(connection.getResponseCode() == HttpURLConnection.HTTP_OK){
  123 + InputStream in = connection.getInputStream();
  124 + String currentLine = "";
  125 + if(in != null){
  126 + BufferedReader br = new BufferedReader(new InputStreamReader(in,"utf-8"));
  127 + while((currentLine = br.readLine()) != null){
  128 + result += currentLine;
  129 + }
  130 + br.close();
  131 + }
  132 + }
  133 + }catch (Exception e) {
  134 + e.printStackTrace();
  135 + }
  136 +
  137 + if(BaseUtil.notBlank(result)) {
  138 + JSONObject resultJson = JSONObject.parseObject(result);
  139 + return resultJson.getJSONObject("data").getString("hls_url_rate2");
  140 + }
  141 +
  142 + return "";
  143 + }
  144 +```
0 \ No newline at end of file 145 \ No newline at end of file
02.直播云/1.2 获取flash直播URL接口.md 0 → 100644
  1 +### 获取RTMP直播播放URL接口
  2 +-----
  3 +#### URL: http://api.cnlive.com/open/api2/play/IPS/liveplayBySWF
  4 +-----
  5 +#### 接口说明: 返回RTMP/FLV直播播放地址 (供 swf或 PC页面 调用)
  6 +-----
  7 +#### 请求方式: HTTP GET
  8 +-----
  9 +#### 返回格式: 200
  10 +-----
  11 +#### 请求参数说明:
  12 +| 参数名 | 参数类型 | 必选 | 参数说明 |
  13 +| :----------- | :------: | :------: | :------: |
  14 +| sp_id | string | true | 应用ID |
  15 +| channelID| string | true | 直播频道或 devID_主播ID |
  16 +| uid| string | false | 用户标识(uuid_时间戳)|
  17 +| sid| string | false | 用户ID |
  18 +| retry | int | false | 重试次数,在0~4之间累加 |
  19 +| rate | int | false | 1-流畅,2-标清,3-高清,4-超清,不传为2,EPG接口会返回实际的码流路数--标清为必须项|
  20 +
  21 +
  22 +#### 页面播放DEMO:
0 \ No newline at end of file 23 \ No newline at end of file
02.直播云/1.3 创建直播活动接口.md 0 → 100644
  1 +### 创建直播活动接口
  2 +-----
  3 +#### URL: http://api.cnlive.com/open/api3/play/IPS/CreateActivity
  4 +-----
  5 +#### 接口说明: 返回直播播放地址
  6 +-----
  7 +#### 请求方式: HTTP GET
  8 +-----
  9 +#### 返回格式: 200
  10 +-----
  11 +#### 请求参数说明:
  12 +| 参数名 | 参数类型 | 必选 | 参数说明 |
  13 +| :----------- | :------: | :------: | :------: |
  14 +| sp_id | string(20) | true | 应用ID |
  15 +| activityid| string(32) | true | 活动ID,确保SP下的唯一性 |
  16 +| activityname | string(64) | true | 活动名称 |
  17 +| activitystatus | int | true | 活动状态,0:未开始 /1:已开始 /3:已结束 /4 已下线,默认为0 |
  18 +| isHorizontalScreen | int | true | 屏幕方向,0:垂直即竖屏 /1:水平即横屏 ,默认为1 |
  19 +| channelID | string(32) | true | 播放通道;PGC业务:平台分配/ UGC业务:主播ID生成,确保SP下的唯一性 |
  20 +| startTime | string | false | 开始时间,格式yyyyMMddHHmmss |
  21 +| endTime | string | false | 开始时间,格式yyyyMMddHHmmss |
  22 +| coverImgUrl | string(512) | false | 活动封面 |
  23 +| activityCategory | string | false | 活动分类ID,999 -未知/001 发布会/002 婚礼/003 年会 /004 体育/005 游戏/006 旅游&户外/007 财经/008 演唱会/009 烹饪/010 宠物&动物/011 访谈/012 教育/013 竞技/014 剧场/015 晚会/016 电视节目/017 秀场 |
  24 +| extensions | string(text) | false | 扩展字段,参数格式为Map对象的Json字符串(主播昵称、头像、) |
  25 +| uuid | string(64) | false | 用户设备号 |
  26 +| sign | String | true | 签名规则见<a href="http://help.open.cnlive.com/common.html">签名详情</a> |
  27 +
  28 +#### 返回说明:
  29 +```json
  30 +{
  31 + "errorCode":"0",
  32 + "messagae":"请求成功"
  33 +}
  34 +```
0 \ No newline at end of file 35 \ No newline at end of file
02.直播云/1.4 启动直播活动接口.md 0 → 100644
  1 +### 创建直播活动接口
  2 +-----
  3 +#### URL: http://api.cnlive.com/open/api3/play/IPS/StartActivity
  4 +-----
  5 +#### 接口说明: 返回直播播放地址
  6 +-----
  7 +#### 请求方式: HTTP GET
  8 +-----
  9 +#### 返回格式: 200
  10 +-----
  11 +#### 请求参数说明:
  12 +| 参数名 | 参数类型 | 必选 | 参数说明 |
  13 +| :----------- | :------: | :------: | :------: |
  14 +| sp_id | string | true | 应用ID |
  15 +| activityid| string | true | 活动ID,确保SP下的唯一性 |
  16 +| sign | String | true | 签名规则见<a href="http://help.open.cnlive.com/common.html">签名详情</a> |
  17 +
  18 +#### 返回说明:
  19 +```json
  20 +{
  21 + "errorCode":"0",
  22 + "messagae":"请求成功"
  23 +}
  24 +```
0 \ No newline at end of file 25 \ No newline at end of file
02.直播云/1.5 停止直播活动接口.md 0 → 100644
  1 +### 创建直播活动接口
  2 +-----
  3 +#### URL: http://api.cnlive.com/open/api3/play/IPS/CloseActivity
  4 +-----
  5 +#### 接口说明: 返回直播播放地址
  6 +-----
  7 +#### 请求方式: HTTP GET
  8 +-----
  9 +#### 返回格式: 200
  10 +-----
  11 +#### 请求参数说明:
  12 +| 参数名 | 参数类型 | 必选 | 参数说明 |
  13 +| :----------- | :------: | :------: | :------: |
  14 +| sp_id | string | true | 应用ID |
  15 +| activityid| string | true | 活动ID,确保SP下的唯一性 |
  16 +| sign | String | true | 签名规则见<a href="http://help.open.cnlive.com/common.html">签名详情</a> |
  17 +
  18 +#### 返回说明:
  19 +```json
  20 +{
  21 + "errorCode":"0",
  22 + "messagae":"请求成功",
  23 + data{
  24 + vid:"xxxxxx"
  25 + }
  26 +}
  27 +```
0 \ No newline at end of file 28 \ No newline at end of file
02.直播云/1.6 获取直播活动列表接口.md 0 → 100644
  1 +### 创建直播活动接口
  2 +-----
  3 +#### URL: http://api.cnlive.com/open/api3/play/IPS/CreateActivity
  4 +-----
  5 +#### 接口说明: 返回直播播放地址
  6 +-----
  7 +#### 请求方式: HTTP GET
  8 +-----
  9 +#### 返回格式: 200
  10 +-----
  11 +#### 请求参数说明:
  12 +| 参数名 | 参数类型 | 必选 | 参数说明 |
  13 +| :----------- | :------: | :------: | :------: |
  14 +| sp_id | string | true | 应用ID |
  15 +| activityid| string | true | 活动ID,确保SP下的唯一性 |
  16 +| activityname | string | false | 活动名称 |
  17 +| channelID | string | true | 播放通道;PGC:平台分配/UGC:主播ID生成,确保SP下的唯一性 |
  18 +| sp_id | string | true | 应用ID |
  19 +| sign | String | true | 签名规则见<a href="http://help.open.cnlive.com/common.html">签名详情</a> |
  20 +
  21 +#### 返回说明:
  22 +```json
  23 +{
  24 + "errorCode":"0",
  25 + "messagae":"请求成功"
  26 +}
  27 +```
0 \ No newline at end of file 28 \ No newline at end of file
02.直播云/1.7 获取直播回放接口.md 0 → 100644
  1 +### 创建直播活动接口
  2 +-----
  3 +#### URL: http://api.cnlive.com/open/api3/play/IPS/CreateActivity
  4 +-----
  5 +#### 接口说明: 返回直播播放地址
  6 +-----
  7 +#### 请求方式: HTTP GET
  8 +-----
  9 +#### 返回格式: 200
  10 +-----
  11 +#### 请求参数说明:
  12 +| 参数名 | 参数类型 | 必选 | 参数说明 |
  13 +| :----------- | :------: | :------: | :------: |
  14 +| sp_id | string | true | 应用ID |
  15 +| activityid| string | true | 活动ID,确保SP下的唯一性 |
  16 +| activityname | string | false | 活动名称 |
  17 +| channelID | string | true | 播放通道;PGC:平台分配/UGC:主播ID生成,确保SP下的唯一性 |
  18 +| sp_id | string | true | 应用ID |
  19 +| sign | String | true | 签名规则见<a href="http://help.open.cnlive.com/common.html">签名详情</a> |
  20 +
  21 +#### 返回说明:
  22 +```json
  23 +{
  24 + "errorCode":"0",
  25 + "messagae":"请求成功"
  26 +}
  27 +```
0 \ No newline at end of file 28 \ No newline at end of file
02.直播云/1.8 获取APP直播URL接口.md 0 → 100644
  1 +### 获取APP直播URL接口
  2 +-----
  3 +#### URL: http://api.cnlive.com/open/api3/play/IPS/liveplayByAPP
  4 +-----
  5 +#### 接口说明: 返回直播播放地址 (HLS or RTMP)
  6 +-----
  7 +#### 请求方式: HTTP GET
  8 +-----
  9 +#### 返回格式: 200
  10 +-----
  11 +#### 请求参数说明:
  12 +| 参数名 | 参数类型 | 必选 | 参数说明 |
  13 +| :----------- | :------: | :------: | :------: |
  14 +| sp_id | string | true | 应用ID |
  15 +| channelID| string | true | 直播频道或主播ID |
  16 +| uid| string | false | 用户标识(uuid_时间戳),不传为0 |
  17 +| sid| string | false | 用户ID,不传为0 |
  18 +| isHLS | int | false | 0(FLV/MP4流),1(HLS流),不传则默认为1|
  19 +| retry | int | false | 重试次数,在0--4之间递增累加 |
  20 +| rate | int | false | 1-流畅,2-标清,3-高清,4-超清,不传为2, getLiveActivityPlayInfo 接口会返回实际的码流路数|
  21 +| sign | String | true | 签名规则见<a href="http://help.open.cnlive.com/common.html">签名详情</a> |
0 \ No newline at end of file 22 \ No newline at end of file
02.直播云/1.9 获取H5直播URL接口.md 0 → 100644
  1 +### 获取直播URL接口
  2 +-----
  3 +#### URL: http://api.cnlive.com/open/api3/play/IPS/liveplayByH5
  4 +-----
  5 +#### 接口说明: 返回直播播放地址(HLS)
  6 +-----
  7 +#### 请求方式: HTTP GET
  8 +-----
  9 +#### 返回格式: 302
  10 +-----
  11 +#### 请求参数说明:
  12 +| 参数名 | 参数类型 | 必选 | 参数说明 |
  13 +| :----------- | :------: | :------: | :------: |
  14 +| sp_id | string | true | 应用ID |
  15 +| channelID| string | true | 直播频道或主播ID |
  16 +| uuid| string | false | 用户标识(uuid_时间戳),不传为0 |
  17 +| sid| string | false | 用户ID,不传为0 |
  18 +| retry | int | false | 重试次数,从0开始,不断累加,不传为0 |
  19 +| rate | int | false | 1-流畅,2-标清,3-高清,4-超清,不传为2,EPG接口会返回实际的码流路数--标清为必须项|
0 \ No newline at end of file 20 \ No newline at end of file