接口名称 小程序获取flash点播URL    
地址 https://api.cnlive.com/open/api2/vod_ips/vodplayByApplication
method post
返回数据 json

获取MP4播放URL接口


URL: http://api.cnlive.com/open/api2/vod_ips/vodplayBySWF


接口说明: 返回MP4播放地址 (供 swf或 PC页面 调用)


请求方式: HTTP GET


返回格式: 200


请求参数说明:

参数名 参数类型 必选 参数说明
appId string true 应用ID
vId string true 点播节目标识
uid string false 用户标识(uuid_时间戳)
sid string false 用户ID
retry int false 重试次数,在0~4之间累加
rate int false 1-流畅,2-标清,3-高清,4-超清,不传为2,EPG接口会返回实际的码流路数--标清为必须项

返回结果 json

 {
 "errorMessage":"成功",
 "data":{
 "videoUrl":"http://wideo01.cnlive.com/video/data1/2016/0524/124025/800/b7e34cfee140449f9e04c5e85b66aa56_124025_800.mp4"
 },
 "errorCode":"0"
 }

java 示例

    public String getFlashUrl() {
        String result = "";
        String mp4Url = "http://api.cnlive.com/open/api2/vod_ips/vodplayBySWF?appId=iqj730vn11&vId=174e6c5f3d9e4ddeb739feed1906fa11&rate=2";
        try {
            URL requestUrl = new URL(mp4Url);
            connection = (HttpURLConnection)requestUrl.openConnection();
            connection.setRequestMethod("GET");
            connection.setDoInput(true);
            connection.setDoOutput(true);
            connection.connect();//连接

            //获得返回值
            if(connection.getResponseCode() == HttpURLConnection.HTTP_OK){
                InputStream in = connection.getInputStream();
                String currentLine = "";
                if(in != null){
                    BufferedReader br = new BufferedReader(new InputStreamReader(in,"utf-8"));
                    while((currentLine = br.readLine()) != null){
                        result += currentLine;
                    }
                    br.close();
                }
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
        if(BaseUtil.notBlank(result)) {
            resultJson = JSONObject.parseObject(result);
            result = resultJson.getJSONObject("data").getString("location");
        }
        return result;
    }

页面播放DEMO