Commit d4790d012b919bf993af14c3c0a2c0304c1b1878
1 parent
adc2a01c
点播接口
Showing
3 changed files
with
90 additions
and
0 deletions
01.点播云/1.2 获取点播URL接口.md renamed to 01.点播云/1.2 获取h5点播URL接口.md
01.点播云/1.3 获取flash点播URL接口.md
0 → 100644
| 1 | +### 获取RTMP直播播放URL接口 | |
| 2 | +----- | |
| 3 | +#### URL: http://api.cnlive.com/open/api2/live_ips/liveplayBySWF | |
| 4 | +----- | |
| 5 | +#### 接口说明: 返回RTMP/FLV直播播放地址 (供 swf或 PC页面 调用) | |
| 6 | +----- | |
| 7 | +#### 请求方式: HTTP GET | |
| 8 | +----- | |
| 9 | +#### 返回格式: 200 | |
| 10 | +----- | |
| 11 | +#### 请求参数说明: | |
| 12 | +| 参数名 | 参数类型 | 必选 | 参数说明 | | |
| 13 | +| :----------- | :------: | :------: | :------: | | |
| 14 | +| appId | 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 | +#### 返回结果 json | |
| 22 | +```json | |
| 23 | + { | |
| 24 | + "errorMessage":"成功", | |
| 25 | + "data":{ | |
| 26 | + "location":"rtmp://wsrtmp4.live.cnlive.com/cdn/xinyingshi?wsSecret=f10722a1a2ffd198772b2ac8cf1c0afb&wsTime=57a3f066" | |
| 27 | + }, | |
| 28 | + "errorCode":"0" | |
| 29 | + } | |
| 30 | +``` | |
| 31 | + | |
| 32 | +#### java 示例 | |
| 33 | + | |
| 34 | +```java | |
| 35 | + public String getFlashUrl() { | |
| 36 | + String result = ""; | |
| 37 | + String mp4Url = "http://api.cnlive.com/open/api2/live_ips/liveplayBySWF?channelID=xinyingshi&appId=iqj730vn11"; | |
| 38 | + try { | |
| 39 | + URL requestUrl = new URL(mp4Url); | |
| 40 | + connection = (HttpURLConnection)requestUrl.openConnection(); | |
| 41 | + connection.setRequestMethod("GET"); | |
| 42 | + connection.setDoInput(true); | |
| 43 | + connection.setDoOutput(true); | |
| 44 | + connection.connect();//连接 | |
| 45 | + | |
| 46 | + //获得返回值 | |
| 47 | + if(connection.getResponseCode() == HttpURLConnection.HTTP_OK){ | |
| 48 | + InputStream in = connection.getInputStream(); | |
| 49 | + String currentLine = ""; | |
| 50 | + if(in != null){ | |
| 51 | + BufferedReader br = new BufferedReader(new InputStreamReader(in,"utf-8")); | |
| 52 | + while((currentLine = br.readLine()) != null){ | |
| 53 | + result += currentLine; | |
| 54 | + } | |
| 55 | + br.close(); | |
| 56 | + } | |
| 57 | + } | |
| 58 | + }catch (Exception e) { | |
| 59 | + e.printStackTrace(); | |
| 60 | + } | |
| 61 | + if(BaseUtil.notBlank(result)) { | |
| 62 | + resultJson = JSONObject.parseObject(result); | |
| 63 | + result = resultJson.getJSONObject("data").getString("location"); | |
| 64 | + } | |
| 65 | + return result; | |
| 66 | + } | |
| 67 | +``` | |
| 68 | + | |
| 69 | +#### [页面播放DEMO](http://open.cnlive.com/demo/live/flash_live_demo.html) | |
| 0 | 70 | \ No newline at end of file | ... | ... |
01.点播云/1.4 获取APP点播URL接口.md
0 → 100644
| 1 | +### 获取APP直播URL接口 | |
| 2 | +----- | |
| 3 | +#### URL: http://api.cnlive.com/open/api2/live_ips/liveplayByAPP | |
| 4 | +----- | |
| 5 | +#### 接口说明: 返回直播播放地址 (HLS or RTMP) | |
| 6 | +----- | |
| 7 | +#### 请求方式: HTTP GET | |
| 8 | +----- | |
| 9 | +#### 返回格式: 200 | |
| 10 | +----- | |
| 11 | +#### 请求参数说明: | |
| 12 | +| 参数名 | 参数类型 | 必选 | 参数说明 | | |
| 13 | +| :----------- | :------: | :------: | :------: | | |
| 14 | +| appId | 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 | 22 | \ No newline at end of file | ... | ... |