Polyv Help Center

Help Center

Upload Video Screenshot at Specified Time Point

Updated: 2022-05-23 19:02:59

Interface URL

https://api.polyv.net/v2/video/upload-image-in-position

Interface Description

上传指定时间点的视频截图, 如果时间点对应的图片已存在,则会返回旧图片路径

Request Method

POST
Content-Type:multipart/form-data;

Request Parameters

Parameter Name Required Type and Range Description
userid true string User ID
ptime true long 13-digit millisecond timestamp of the current time
sign true String Signature, a 40-character uppercase SHA1 value [See Signature Generation Rules]
vid true string Video VID
position true int Screenshot position (time point of the video), unit: seconds
imageFile true file Image file, size must not exceed 5MB, this parameter does not participate in signing

Return Result

JSON Example

上传成功
{
    "code": 200,
    "status": "success",
    "message": "success",
    "data": {
        "vid": "a2dc4f2517dadf1bb312be765089e860_a"
        "position": 10,
        "imageUrl": "http://ab-upload.polyv.net/test/polyv.jpg",
        "exists": 0
    }
}

JSON Example for Failed Request

时间戳过期
{
    "code": 400,
    "status": "error",
    "message": "ptime is too old",
    "data": null
}
签名不正确
{
    "code": 400,
    "status": "error",
    "message": "the sign is not right.",
    "data": null
}
图片大小不能超过5M
{
    "code": 400,
    "status": "error",
    "message": "ImageFile size can’t more than 5M",
    "data": null
}

Field Description

Field Description
code Request return status code
status Request return status
message Request return message
data Request return data
imageUrl Image access URL
vid Video VID
position Screenshot position (time point of the video), unit: seconds
exists Whether the image at this time point exists, 1: exists, 0: does not exist

Java Request Example

public void testUploadPositionImage() {
        String url = "https://api.polyv.net/v2/video/upload-image-in-position";
        String userid = "xxxxxxx";
        String vid = "xxxxxxxxxxxxxxxxxxxx";
        int position = 10;
        String secretkey = "xxxxxxx";
        long ptime = System.currentTimeMillis();

        Map<String, String> params = new HashMap<>();
        params.put("position", String.valueOf(position));
        params.put("ptime", String.valueOf(ptime));
        params.put("userid", userid);
        params.put("vid", "xxx");
        params.put("sign", getSign(params, secretkey));
        String content = HttpClientUtil.getInstance().sendHttpPost(url, params);
        System.out.println(content);
}
联系客服,在线咨询