查询视频信息

接口URL

https://api.polyv.net/v3/video/get-video-info

接口说明

(接口调用有频率限制,详细请查看)

1、接口用于查询视频信息
2、接口支持https

请求方式

GET,POST

请求参数

参数名 必选 类型 说明
appId string 子账号appId
timestamp long 当前13位当前时间戳,3分钟有效
sign string 签名值,32位大写MD5值
vids string 视频ID,多个视频ID用英文逗号分隔
filter string 选择需要返回的视频信息,多个以英文逗号分隔,取值:basicInfo,metaData,transcodeInfo,snapshotInfo, 分别代表基础信息、元数据、转码信息、截图信息,为空则返回基础信息

响应成功JSON示例:

// 请求成功
{
    "requestId": "0320c7a6-223c-437e-b694-1f652f1f44d0",
    "code": 200,
    "status": "success",
    "error": null,
    "data": [
        {
            "vid": "a2dc4f25172872650e7d5c1b8026b13c_a",
            "basicInfo": {
                "title": "合并-a2dc4f25175d64f185bf631591fb08d0",
                "description": "",
                "duration": 246.0,
                "coverURL": "https://img.videocc.net/uimage/a/a2dc4f2517/first_image/76031009-3478-4b0e-a711-52dcccd7557c_b.jpg",
                "creationTime": "2021-04-30 01:03:41",
                "updateTime": "2021-05-01 00:33:55",
                "size": 115608008,
                "status": 61,
                "cateId": 1,
                "cateName": "默认分类",
                "tags": "",
                "uploader": null,
                "playTimes": 6
            },
            "metaData": {
                "size": 115608008,
                "format": "flv",
                "duration": 246.0,
                "bitrate": 3017,
                "fps": 0,
                "height": 1080,
                "width": 1920,
                "codec": "h264"
            },
            "transcodeInfos": [
                {
                    "playUrl": "https://mpv.videocc.net/a2dc4f2517/c/a2dc4f25172872650e7d5c1b8026b13c_1.mp4",
                    "definition": "LD",
                    "bitrate": 602,
                    "duration": 246.0,
                    "encrypt": false,
                    "format": "mp4",
                    "fps": 0,
                    "height": 1080,
                    "width": 1920,
                    "status": "normal"
                }
            ],
            "snapshotInfo": {
                "imageUrl": [
                    "https://img.videocc.net/uimage/a/a2dc4f2517/c/a2dc4f25172872650e7d5c1b8026b13c_0.jpg",
                    "https://img.videocc.net/uimage/a/a2dc4f2517/c/a2dc4f25172872650e7d5c1b8026b13c_1.jpg",
                    "https://img.videocc.net/uimage/a/a2dc4f2517/c/a2dc4f25172872650e7d5c1b8026b13c_2.jpg",
                    "https://img.videocc.net/uimage/a/a2dc4f2517/c/a2dc4f25172872650e7d5c1b8026b13c_3.jpg",
                    "https://img.videocc.net/uimage/a/a2dc4f2517/c/a2dc4f25172872650e7d5c1b8026b13c_4.jpg",
                    "https://img.videocc.net/uimage/a/a2dc4f2517/c/a2dc4f25172872650e7d5c1b8026b13c_5.jpg"
                ]
            }
        }
    ]
}

响应失败JSON示例:

// 时间戳错误
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 100,
        "desc": "invalid timestamp"
    },
    "data": null
}
// appId不正确
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 101,
        "desc": "application not exist"
    },
    "data": null
}
// 子账号不存在
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 102,
        "desc": "user children not exist"
    },
    "data": null
}
// 子账号过期
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 403,
    "status": "error",
    "error": {
        "code": 103,
        "desc": "user children expired"
    },
    "data": null
}
// 签名错误
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 403,
    "status": "error",
    "error": {
        "code": 104,
        "desc": "invalid signature"
    },
    "data": null
}
// 账号权限不足
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 403,
    "status": "error",
    "error": {
        "code": 105,
        "desc": "permission limited"
    },
    "data": null
}
// 视频vid错误
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 2000,
        "desc": "invalid vid"
    },
    "data": null
}

字段说明

字段 说明
requestId 本次请求的ID
code 响应http状态码
status 状态
error.code 错误码
error.desc 错误描述
data 返回数据
data[0].vid 视频id
data[0].basicInfo.title 视频标题
data[0].basicInfo.description 视频描述
data[0].basicInfo.duration 源视频时长,单位:秒
data[0].basicInfo.coverURL 首图地址,大图
data[0].basicInfo.creationTime 创建时间
data[0].basicInfo.updateTime 更新时间
data[0].basicInfo.size 源文件大小,单位:Bytes
data[0].basicInfo.status 视频状态码
data[0].basicInfo.cateId 分类id, 如1为根目录
data[0].basicInfo.cateName 分类名称
data[0].basicInfo.tags 标签
data[0].basicInfo.uploader 上传者
data[0].transcodeInfos.playUrl 播放地址
data[0].transcodeInfos.definition 清晰度,SOURCE:原清晰度,LD:普清,SD:标清,HD:高清
data[0].transcodeInfos.duration 时长,秒
data[0].transcodeInfos.encrypt 加密视频为true,非加密为false
data[0].transcodeInfos.format 转码格式,如mp4、flv、pdx、hls
data[0].transcodeInfos.fps 视频帧率
data[0].transcodeInfos.bitrate 码率kbps
data[0].transcodeInfos.height 分辨率高,单位:px
data[0].transcodeInfos.width 分辨率宽,单位:px
data[0].transcodeInfos.status 视频状态, normal:可以正常播放,unavailable:不能正常播放
data[0].metaData.size 源文件大小,单位:Bytes
data[0].metaData.format 视频容器类型,如mp4、flv等
data[0].metaData.duration 源视频时长,单位:秒
data[0].metaData.bitrate 视频码率,单位:bps
data[0].metaData.fps 视频帧率
data[0].metaData.height 分辨率高,单位:px
data[0].metaData.width 分辨率宽,单位:px
data[0].metaData.codec 编码格式,如h264、h265等
data[0].snapshotInfo.imageUrl 截图url数组
视频状态码 含义
60/61 已发布
10 等待编码
20 正在编码
50 等待审核
51 审核不通过
-1 已删除

java请求示例

public void testGetVideoInfo() {
        String url = "https://api.polyv.net/v3/video/get-video-info";
        // appId和加密串
        String appId = "xxxxxxx";
        String appSecret = "xxxxxxxxxxxxxxxxxx";

        Map<String, String> params = new HashMap<>();
        params.put("vids", "abc,def");
        params.put("filters", "basicInfo,metaData,,transcodeInfo,snapshotInfo");
        // 调用Polyv的工具类方法设置sign
        PolyvTool.setLiveSign(params, appId, appSecret);
        String content = HttpClientUtil.getInstance()
                .sendHttpGet(url + "?" +  PolyvTool.mapJoinNotEncode(params));
        System.out.println(content);
}

签名规则及工具文件代码

https://dev.polyv.net/2020/liveproduct/l-api/rule/live-api-java-detail/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...