Polyv Help Center

Help Center

Query Keyframe Information

Updated: 2025-01-14 15:57:30

API Description

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

API URL

http://api.polyv.net/v2/video/{userid}/keyframe/{vid}

Online API Call

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. API calls have frequency limits. See details

Request Parameter Description

Parameter Required Type Description
ptime true Long Current time in milliseconds timestamp, valid for 3 minutes
sign true String Signature, a 40-character uppercase SHA1 value. The secretkey used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server to obtain response data. See signature generation rules
vid true String Video ID

Example

http://api.polyv.net/v2/video/1b448be323/keyframe/1b448be323b8d9b9489dcd7e8e09f087_1?vid=1b448be323b8d9b9489dcd7e8e09f087_1&sign=9FD6BA6486D1655C1D1A27C436F835C43BEB8406&ptime=1617174767293

Response Parameter Description

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure. See global error description
status String Response status text
message String Response description. When code is 400 or 500, provides auxiliary error reason
data Object Returns video keyframe information on success. See data field description

data Parameter Description

Field Type Description
duration String Video duration, format: HH:mm:ss, e.g., 00:02:19
keyframeList Array List of keyframe information. See keyframeList field description

keyframeList Parameter Description

Field Type Description
id Integer Keyframe ID
seconds Integer Keyframe time point, in seconds
keyContent String Keyframe detail content
btnsettingswitch String Keyframe button setting switch. Not passed means disabled.
Y: Enabled
N: Disabled
btndesc String Button description
btnhref String Button redirect URL

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click to download source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and VodSignUtil.java in the downloaded file.

It is strongly recommended to use the VOD Java SDK for API functionality integration. The VOD Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

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

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "message": "success",
    "data": {
        "duration": "00:02:19",
        "keyframeList": [
            {
                "seconds": 10,
                "keyContent": "测试打点10s"
            },
            {
                "seconds": 20,
                "keyContent": "测试打点20s"
            }
        ]
    }
}

Error Example

{
    "code": 400,
    "status": "error",
    "message": "the sign is not right.",
    "data": ""
}
联系客服,在线咨询
在线咨询