查询视频信息

接口描述

1、通过视频id查询视频信息
2、接口URL中的{userId}为点播账号userId,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议

接口URL

http://api.polyv.net/v2/video/{userid}/get-video-info

在线API调用

请求方式

GET

接口约束

1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看

请求参数描述

参数名必选类型说明

userId

true

String

保利威点播账户id,可以参考【获取密钥】获取,获取路径:官网->登录->点播(API接口)

ptime

true

Long

当前时间的毫秒级时间戳,3分钟内有效

sign

true

String

签名,为40位大写的SHA1值,生成签名的secretkey密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则

vid

true

String

视频id(可以支持多个,用英文逗号隔开),最多同时传100个视频id

示例

http://api.polyv.net/v2/video/1b448be323/get-video-info

表单参数:

vid=1b448be3231361255350f047cd7ed6bb_1,1b448be323b8d9b9489dcd7e8e09f087_1&sign=29D75C8F042389E667A09D10C94F38A90DF05CC6&userid=1b448be323&ptime=1617096538024

响应参数描述

参数名类型说明

code

Integer

响应状态码,200为成功返回,非200为失败【详见全局错误说明

status

String

响应状态文本信息

message

String

响应描述信息,当code为400或者500的时候,辅助描述错误原因

data

Array

响应成功时返回视频详细信息【详见data字段说明

data参数描述

字段类型说明

vid

String

视频id

basicInfo

Object

视频基础信息【详见basicInfo参数描述

metaData

Object

视频元数据【详见metaData参数描述

transcodeInfos

Array

转码信息【详见transcodeInfos参数描述

snapshotInfo

Object

截图信息【详见snapshotInfo参数描述

basicInfo参数描述

字段类型说明

title

String

视频标题

description

String

视频描述

duration

Integer

视频时长,单位:秒

coverURL

String

首图地址,大图

miniCoverURL

String

首图地址,小图

largeCoverURL

String

首图地址,大图,同coverURL

audioUrl

String

音频地址, 如果视频没有音频, 返回空字符串

creationTime

String

创建时间,格式:yyyy-MM-dd HH:mm:ss

updateTime

String

更新时间,格式:yyyy-MM-dd HH:mm:ss

size

Long

源文件大小,单位:字节

status

Integer

视频状态码 60/61:已发布 10:等待编码 20:正在编码 40:编码失败 50:等待审核 51:审核不通过 -1:已删除

cateId

Long

分类id,如1为默认分类

cateName

String

分类名称

tags

String

视频标签

uploader

String

上传者

metaData参数描述

字段类型说明

size

Long

源文件大小,单位:字节

format

String

视频容器类型,如mp4、flv等

duration

Integer

源视频时长,单位:秒

bitrate

Integer

视频码率,单位:bps

fps

Integer

视频帧率

height

Integer

分辨率高,单位:像素

width

Integer

分辨率宽,单位:像素

codec

String

编码格式,如h264、h265等

transcodeInfos参数描述

字段类型说明

playUrl

String

播放地址

definition

String

清晰度 SOURCE:原清晰度 LD:普清 SD:标清 HD:高清

bitrate

Integer

视频码率,单位:kbps

duration

Integer

时长,单位:秒

encrypt

Boolean

视频是否加密 true:加密视频 false:非加密

format

String

转码格式,如mp4、flv、pdx、hls

fps

Integer

视频帧率

height

Integer

分辨率高,单位:像素

width

Integer

分辨率宽,单位:像素

status

String

视频状态 normal:正常播放 unavailable:不能正常播放

fileSize

Long

编码后视频大小,单位:字节

snapshotInfo参数描述

字段类型说明

imageUrl

String[]

视频截图url

Java请求示例

快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 VodSignUtil.java 都包含在下载文件中。

强烈建议您使用点播Java SDK完成API的功能对接,点播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。

private static final Logger log = LoggerFactory.getLogger(VodVideoManagementTest.class);
/**
 * 查询视频信息
 * @throws Exception
 * @throws NoSuchAlgorithmException
 */
@Test
public void testGetVideoInfo() throws Exception, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String secretKey = super.secretKey;
    String userId = super.userId;
    String ptime = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = String.format("http://api.polyv.net/v2/video/%s/get-video-info", userId);
    String vid = "1b448be3231361255350f047cd7ed6bb_1,1b448be323b8d9b9489dcd7e8e09f087_1";
    
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("ptime", ptime);
    requestMap.put("vid", vid);
    requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
    String response = HttpUtil.postFormBody(url, requestMap);
    log.debug("测试查询视频信息,{}", response);
    //do somethings
    
}

响应示例

系统全局错误说明详见全局错误说明

成功示例

{
    "code": 200,
    "status": "success",
    "message": "success",
    "data": [
        {
            "vid": "1b448be323fddcd3f8823f534918039e_1",
            "basicInfo": {
                "title": "保利威宣传视频",
                "description": "保利威是全球领先的企业直播服务商,隶属于广州易方信息科技股份有限公司,致力于通过可集成、可定制的视频直播技术,为企业搭建自主私域直播系统,并提供直播全流程运营与现场执行服务。",
                "duration": 109,
                "thumbnailURL": "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_0.jpg",
                "coverURL": "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_0_b.jpg",
                "audioUrl": "https://mpv.videocc.net/1b448be323/3/1b448be323efac457efa048ec56ae2a3_1.mp3",
                "creationTime": "2022-12-13 09:14:07",
                "updateTime": "2022-12-13 09:15:15",
                "size": 18839865,
                "status": 61,
                "cateId": 1,
                "cateName": "默认分类",
                "tags": "宣传视频",
                "uploader": "主账号",
                "playTimes": 0,
                "md5Checksum": "4b88804c015da508b5008f95846befc1",
                "extContent": null
            },
            "metaData": {
                "size": 18839865,
                "format": "mp4",
                "duration": 109,
                "bitrate": 1211,
                "fps": 30,
                "height": 1080,
                "width": 1920,
                "codec": "h264"
            },
            "transcodeInfos": [
                {
                    "playUrl": null,
                    "definition": "LD",
                    "bitrate": 399,
                    "duration": 109,
                    "encrypt": true,
                    "format": "pdx",
                    "fps": 30,
                    "height": 360,
                    "width": 640,
                    "status": "normal",
                    "fileSize": 7770204
                },
                {
                    "playUrl": "https://hls.videocc.net/1b448be323/e/1b448be323fddcd3f8823f534918039e_1.m3u8",
                    "definition": "LD",
                    "bitrate": 399,
                    "duration": 109,
                    "encrypt": true,
                    "format": "hls",
                    "fps": 30,
                    "height": 360,
                    "width": 640,
                    "status": "normal",
                    "fileSize": 7770204
                },
                {
                    "playUrl": null,
                    "definition": "SD",
                    "bitrate": 892,
                    "duration": 109,
                    "encrypt": true,
                    "format": "pdx",
                    "fps": 30,
                    "height": 540,
                    "width": 960,
                    "status": "normal",
                    "fileSize": 14509172
                },
                {
                    "playUrl": "https://hls.videocc.net/1b448be323/e/1b448be323fddcd3f8823f534918039e_2.m3u8",
                    "definition": "SD",
                    "bitrate": 892,
                    "duration": 109,
                    "encrypt": true,
                    "format": "hls",
                    "fps": 30,
                    "height": 540,
                    "width": 960,
                    "status": "normal",
                    "fileSize": 14509172
                },
                {
                    "playUrl": null,
                    "definition": "HD",
                    "bitrate": 1211,
                    "duration": 109,
                    "encrypt": true,
                    "format": "pdx",
                    "fps": 30,
                    "height": 1080,
                    "width": 1920,
                    "status": "normal",
                    "fileSize": 18866914
                },
                {
                    "playUrl": "https://hls.videocc.net/1b448be323/e/1b448be323fddcd3f8823f534918039e_3.m3u8",
                    "definition": "HD",
                    "bitrate": 1211,
                    "duration": 109,
                    "encrypt": true,
                    "format": "hls",
                    "fps": 30,
                    "height": 1080,
                    "width": 1920,
                    "status": "normal",
                    "fileSize": 18866914
                }
            ],
            "snapshotInfo": {
                "imageUrl": [
                    "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_0.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_1.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_2.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_3.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_4.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_5.jpg"
                ],
                "bigImageUrl": [
                    "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_0_b.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_1_b.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_2_b.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_3_b.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_4_b.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/e/1b448be323fddcd3f8823f534918039e_5_b.jpg"
                ]
            }
        },
        {
            "vid": "1b448be323871ffe3d5a84a3638e82c2_1",
            "basicInfo": {
                "title": "保利威宣传视频",
                "description": "保利威是全球领先的企业直播服务商,隶属于广州易方信息科技股份有限公司,致力于通过可集成、可定制的视频直播技术,为企业搭建自主私域直播系统,并提供直播全流程运营与现场执行服务。",
                "duration": 109,
                "thumbnailURL": "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_0.jpg",
                "coverURL": "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_0_b.jpg",
                "audioUrl": "",
                "creationTime": "2022-12-12 17:47:19",
                "updateTime": "2022-12-12 17:52:07",
                "size": 18839865,
                "status": 61,
                "cateId": 1,
                "cateName": "默认分类",
                "tags": "宣传视频",
                "uploader": "主账号",
                "playTimes": 0,
                "md5Checksum": "4b88804c015da508b5008f95846befc1",
                "extContent": null
            },
            "metaData": {
                "size": 18839865,
                "format": "mp4",
                "duration": 109,
                "bitrate": 1211,
                "fps": 30,
                "height": 1080,
                "width": 1920,
                "codec": "h264"
            },
            "transcodeInfos": [
                {
                    "playUrl": null,
                    "definition": "LD",
                    "bitrate": 399,
                    "duration": 109,
                    "encrypt": true,
                    "format": "pdx",
                    "fps": 30,
                    "height": 360,
                    "width": 640,
                    "status": "normal",
                    "fileSize": 7774918
                },
                {
                    "playUrl": "https://hls.videocc.net/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_1.m3u8",
                    "definition": "LD",
                    "bitrate": 399,
                    "duration": 109,
                    "encrypt": true,
                    "format": "hls",
                    "fps": 30,
                    "height": 360,
                    "width": 640,
                    "status": "normal",
                    "fileSize": 7774918
                },
                {
                    "playUrl": null,
                    "definition": "SD",
                    "bitrate": 892,
                    "duration": 109,
                    "encrypt": true,
                    "format": "pdx",
                    "fps": 30,
                    "height": 540,
                    "width": 960,
                    "status": "normal",
                    "fileSize": 14508330
                },
                {
                    "playUrl": "https://hls.videocc.net/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_2.m3u8",
                    "definition": "SD",
                    "bitrate": 892,
                    "duration": 109,
                    "encrypt": true,
                    "format": "hls",
                    "fps": 30,
                    "height": 540,
                    "width": 960,
                    "status": "normal",
                    "fileSize": 14508330
                },
                {
                    "playUrl": null,
                    "definition": "HD",
                    "bitrate": 1211,
                    "duration": 109,
                    "encrypt": true,
                    "format": "pdx",
                    "fps": 30,
                    "height": 1080,
                    "width": 1920,
                    "status": "normal",
                    "fileSize": 18866914
                },
                {
                    "playUrl": "https://hls.videocc.net/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_3.m3u8",
                    "definition": "HD",
                    "bitrate": 1211,
                    "duration": 109,
                    "encrypt": true,
                    "format": "hls",
                    "fps": 30,
                    "height": 1080,
                    "width": 1920,
                    "status": "normal",
                    "fileSize": 18866914
                }
            ],
            "snapshotInfo": {
                "imageUrl": [
                    "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_0.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_1.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_2.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_3.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_4.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_5.jpg"
                ],
                "bigImageUrl": [
                    "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_0_b.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_1_b.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_2_b.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_3_b.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_4_b.jpg",
                    "https://img.videocc.net/uimage/1/1b448be323/2/1b448be323871ffe3d5a84a3638e82c2_5_b.jpg"
                ]
            }
        }
    ]
}

异常示例

{
    "code": 400,
    "status": "error",
    "message": "找不到视频信息,请确认参数信息正确性",
    "data": ""
}

Last updated