接口名称 获取直播活动播放信息4App     签名
地址 https://api.cnlive.com/open/api2/live_epg/getLiveActivityPlayInfo4App
method post
返回数据 json

/* Title: 1.1 获取某直播活动信息接口 for APP_SDK */

接口描述

接口地址

http://api.cnlive.com/open/api2/live_epg/getLiveActivityPlayInfo4App

接口协议

HTTP GET

接口请求参数

参数名 参数类型 必选 参数说明
appId string true 应用ID
activityId string true 由开发者通过API创建接口或者在直播云管理端创建,保证唯一性
timestamp int true 精确到秒,当前Unix时间戳,请保证请求服务器时间正确
platform_id String true APP bundleID 或 包名,平台做鉴权使用
sign String true 签名规则见 签名详情

返回值

参数名 参数类型 必选 参数说明
errorCode int true 错误类型号
errorMessage string true 错误类型
activityId string true 活动ID,确保SP下的唯一性
activityName string true 活动名称
activityStatus int true 活动状态,0:直播前;1:直播中;2:直播结束;3:回放准备中;4:回放;5:直播下线;-2:直播异常;默认为0
isHorizontalScreen int true 屏幕方向,0:垂直即竖屏 /1:水平即横屏 ,默认为1 |
channelId string true 播放通道;PGC业务:平台分配/ UGC业务:主播ID生成,确保SP下的唯一性
createTime string false 开始时间,格式yyyyMMddHHmmss
startTime string false 开始时间,格式yyyyMMddHHmmss
endTime string false 开始时间,格式yyyyMMddHHmmss
coverImgUrl string false 活动封面
activityCategory string false 活动分类ID,001 发布会/002 婚礼/003 年会 /004 体育/005 游戏/006 旅游&户外/007 财经/008 演唱会/009 烹饪/010 宠物&动物/011 访谈/012 教育/013 竞技/014 剧场/015 晚会/016 电视节目/017 秀场
extensions string false 扩展字段,参数格式为Map对象的Json字符串 (主播昵称、头像等等)
rates string ture 清晰度标识,多个用逗号隔开: 流畅版=1,清晰版=2,高清版=3,超高清=4
extViews 对象数组 false 扩展机位的播放信息(不含主画面PGM的播放信息)

返回JSON格式的节目元数据信息,json示例如下:

{
 "errorCode":"0",
 "message":"请求成功"
 "data"{
 "activityId":"xxxxx",
 "activityStatus":1,
 "activityName":"测试活动",
 "coverImgUrl":"小图图片URL",
 "isHorizontalScreen""1",
 "channelId""xinyingshi",
 "startTime""",
 "endTime""",
 "createTime""",
 "extensions""",
 "activityCategory""",
 "rates":"1,2,3,4",
 "extViews"
 
 "channelId""xinyingshi-1",
 "rates":"2", 
 },
 
 "channelId""xinyingshi-2",
 "rates":"2,3,4", 
  
 ]
 }
}

java示例

public Object getPlayInfo() {
            String result = "";
            Map params = new HashMap<>();
            params.put("appId", "60_iqj730vn11");
            params.put("acitivityId", "d849bb4277be42799df3ffc21654d949");
            params.put("timestamp", System.currentTimeMillis()/1000+"");
            params.put("platform_id", "");
            String url = OpenUtil.buildURL("http://api.cnlive.com/open/api2/live_epg/getLiveActivityPlayInfo", params, "87ef486a53d637524ba75a4ebcb2d6d8c48d00e56fc2d4");
            HttpURLConnection connection;
            try {
                URL requestUrl = new URL(url);
                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)) {
                JSONObject resultJson = JSONObject.parseObject(result);
                return resultJson;
            }

            return "";
        }