Commit 20ef47bf39349a97689f5138d30f969c28500752
Merge remote-tracking branch 'origin/master'
Showing
3 changed files
with
70 additions
and
14 deletions
8.直播云/1.1 获取直播活动信息接口.md
| ... | ... | @@ -26,7 +26,7 @@ HTTP GET |
| 26 | 26 | | :----------- | :------: | :------: | :------: | |
| 27 | 27 | | errorCode | int | true | 错误类型号 | |
| 28 | 28 | | message| string | true | 错误类型 | |
| 29 | -| activityid| string | true | 活动ID,确保SP下的唯一性 | | |
| 29 | +| activityId| string | true | 活动ID,确保SP下的唯一性 | | |
| 30 | 30 | | activityname | string | true | 活动名称 | |
| 31 | 31 | | activitystatus | int | true | 活动状态,0:未开始 /1:已开始 /3:已结束 /4 已下线,默认为0 | |
| 32 | 32 | | isHorizontalScreen | int | true | 屏幕方向,0:垂直即竖屏 /1:水平即横屏 ,默认为1 | |
| ... | ... | @@ -66,31 +66,31 @@ HTTP GET |
| 66 | 66 | “extensions”:“”, |
| 67 | 67 | “activityCategory”:“”, |
| 68 | 68 | "mp4_url_rate1":"", |
| 69 | - "mp4_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplayBySWF?channelID=xinyingshi&rate=2&sp_id=iqhpk8pl19", | |
| 69 | + "mp4_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplayBySWF?channelID=xinyingshi&sp_id=iqhpk8pl19", | |
| 70 | 70 | "mp4_url_rate3":"", |
| 71 | 71 | "mp4_url_rate4":"", |
| 72 | 72 | "hls_url_rate1":"", |
| 73 | - "hls_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplay?channelID=xinyingshi&rate=2&sp_id=iqhpk8pl19", | |
| 73 | + "hls_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplayByH5?channelID=xinyingshi&sp_id=iqhpk8pl19", | |
| 74 | 74 | "hls_url_rate3":"", |
| 75 | 75 | "hls_url_rate4":"", |
| 76 | 76 | "extViews"[ |
| 77 | 77 | { |
| 78 | 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", | |
| 79 | + "mp4_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplayBySWF?channelID=xinyingshi&sp_id=iqhpk8pl19", | |
| 80 | 80 | "mp4_url_rate3":"", |
| 81 | 81 | "mp4_url_rate4":"", |
| 82 | 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", | |
| 83 | + "hls_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplayByH5?channelID=xinyingshi&sp_id=iqhpk8pl19", | |
| 84 | 84 | "hls_url_rate3":"", |
| 85 | 85 | "hls_url_rate4":"" |
| 86 | 86 | }, |
| 87 | 87 | { |
| 88 | 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", | |
| 89 | + "mp4_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplayBySWF?channelID=xinyingshi&sp_id=iqhpk8pl19", | |
| 90 | 90 | "mp4_url_rate3":"", |
| 91 | 91 | "mp4_url_rate4":"", |
| 92 | 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", | |
| 93 | + "hls_url_rate2":"http://api.cnlive.com/open/api3/play/IPS/liveplayByH5?channelID=xinyingshi&sp_id=iqhpk8pl19", | |
| 94 | 94 | "hls_url_rate3":"", |
| 95 | 95 | "hls_url_rate4":"" |
| 96 | 96 | } |
| ... | ... | @@ -102,11 +102,11 @@ HTTP GET |
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | ``` java |
| 105 | -public String getPlayInfo() { | |
| 105 | +public Object getPlayInfo() { | |
| 106 | 106 | String result = ""; |
| 107 | 107 | Map params = new HashMap<>(); |
| 108 | 108 | params.put("sp_id", "iqhpk8pl19"); |
| 109 | - params.put("customID", "d849bb4277be42799df3ffc21654d949"); | |
| 109 | + params.put("activityId", "d849bb4277be42799df3ffc21654d949"); | |
| 110 | 110 | params.put("timestamp", System.currentTimeMillis()/1000+""); |
| 111 | 111 | String url = OpenUtil.buildURL("http://api.cnlive.com/open/api2/zbsc/getLiveActivityPlayInfo", params, "672db30805f848f59ec3728f8347a4a0"); |
| 112 | 112 | HttpURLConnection connection; |
| ... | ... | @@ -136,7 +136,7 @@ public String getPlayInfo() { |
| 136 | 136 | |
| 137 | 137 | if(BaseUtil.notBlank(result)) { |
| 138 | 138 | JSONObject resultJson = JSONObject.parseObject(result); |
| 139 | - return resultJson.getJSONObject("data").getString("hls_url_rate2"); | |
| 139 | + return resultJson; | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | return ""; | ... | ... |
8.直播云/1.2 获取flash直播URL接口.md
| 1 | 1 | ### 获取RTMP直播播放URL接口 |
| 2 | 2 | ----- |
| 3 | -#### URL: http://api.cnlive.com/open/api2/play/IPS/liveplayBySWF | |
| 3 | +#### URL: http://api.cnlive.com/open/api3/play/IPS/liveplayBySWF | |
| 4 | 4 | ----- |
| 5 | -#### 接口说明: 返回RTMP/FLV直播播放地址 (供 swf或 PC页面 调用) | |
| 5 | +#### 接口说明: 接口返回json,json数据(location属性)包含RTMP/FLV直播播放地址 (供 swf或 PC页面 调用) | |
| 6 | 6 | ----- |
| 7 | 7 | #### 请求方式: HTTP GET |
| 8 | 8 | ----- |
| ... | ... | @@ -18,5 +18,58 @@ |
| 18 | 18 | | retry | int | false | 重试次数,在0~4之间累加 | |
| 19 | 19 | | rate | int | false | 1-流畅,2-标清,3-高清,4-超清,不传为2,EPG接口会返回实际的码流路数--标清为必须项| |
| 20 | 20 | |
| 21 | +#### 返回结果 | |
| 21 | 22 | |
| 22 | -#### 页面播放DEMO: | |
| 23 | 23 | \ No newline at end of file |
| 24 | +| 参数名 | 参数类型 | 必选 | 参数说明 | | |
| 25 | +| :----------- | :------: | :------: | :------: | | |
| 26 | +| errorCode | string | true | 错误码:0 成功 | | |
| 27 | +| errorMessage| string | true | 错误类型描述 | | |
| 28 | +| location| string | true | 直播流地址 | | |
| 29 | + | |
| 30 | +```json | |
| 31 | + { | |
| 32 | + "errorCode":"0", | |
| 33 | + "errorMessage":"成功", | |
| 34 | + "location":"rtmp://wsrtmp4.live.cnlive.com/cdn/xinyingshi?wsSecret=a1b8ee5edd76fc8c80eda08cc03bec10&wsTime=57982548" | |
| 35 | + } | |
| 36 | +``` | |
| 37 | +#### java示例: | |
| 38 | + | |
| 39 | +``` java | |
| 40 | + public String getFlashLive() { | |
| 41 | + String result = ""; | |
| 42 | + String mp4Url = "http://api.cnlive.com/open/api3/play/IPS/liveplayBySWF?channelID=xinyingshi&sp_id=iqhpk8pl19"; | |
| 43 | + try { | |
| 44 | + URL requestUrl = new URL(mp4Url); | |
| 45 | + connection = (HttpURLConnection)requestUrl.openConnection(); | |
| 46 | + connection.setRequestMethod("GET"); | |
| 47 | + connection.setDoInput(true); | |
| 48 | + connection.setDoOutput(true); | |
| 49 | + connection.connect();//连接 | |
| 50 | + | |
| 51 | + //获得返回值 | |
| 52 | + if(connection.getResponseCode() == HttpURLConnection.HTTP_OK){ | |
| 53 | + InputStream in = connection.getInputStream(); | |
| 54 | + String currentLine = ""; | |
| 55 | + if(in != null){ | |
| 56 | + BufferedReader br = new BufferedReader(new InputStreamReader(in,"utf-8")); | |
| 57 | + while((currentLine = br.readLine()) != null){ | |
| 58 | + result += currentLine; | |
| 59 | + } | |
| 60 | + br.close(); | |
| 61 | + } | |
| 62 | + } | |
| 63 | + }catch (Exception e) { | |
| 64 | + e.printStackTrace(); | |
| 65 | + } | |
| 66 | + | |
| 67 | + if(BaseUtil.notBlank(result)) { | |
| 68 | + resultJson = JSONObject.parseObject(result); | |
| 69 | + return resultJson.getString("location"); | |
| 70 | + } | |
| 71 | + | |
| 72 | + return ""; | |
| 73 | + } | |
| 74 | +``` | |
| 75 | + | |
| 76 | +### [页面DEMO](http://open.cnlive.com/demo/live/flash_live_demo.html) | |
| 24 | 77 | \ No newline at end of file | ... | ... |
8.直播云/1.9 获取H5直播URL接口.md
| ... | ... | @@ -16,4 +16,7 @@ |
| 16 | 16 | | uuid| string | false | 用户标识(uuid_时间戳),不传为0 | |
| 17 | 17 | | sid| string | false | 用户ID,不传为0 | |
| 18 | 18 | | retry | int | false | 重试次数,从0开始,不断累加,不传为0 | |
| 19 | -| rate | int | false | 1-流畅,2-标清,3-高清,4-超清,不传为2,EPG接口会返回实际的码流路数--标清为必须项| | |
| 20 | 19 | \ No newline at end of file |
| 20 | +| rate | int | false | 1-流畅,2-标清,3-高清,4-超清,不传为2,EPG接口会返回实际的码流路数--标清为必须项| | |
| 21 | + | |
| 22 | + | |
| 23 | +### [页面DEMO](http://open.cnlive.com/demo/live/h5_live_demo.html) | |
| 21 | 24 | \ No newline at end of file | ... | ... |