Polyv Help Center

Help Center

Query Lesson Replay Video

Updated: 2024-10-21 09:33:43

API Description

1、查询课节回放视频
2、接口支持https协议

API URL

https://api.polyv.net/hi-class-api/open/lesson/v1/getPlaybackVideo

Request Method

GET

API Constraints

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

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See Obtaining Secret Key
timestamp true Long Current 13-digit millisecond timestamp, valid within 3 minutes
sign true String Signature, a 32-character uppercase MD5 value See Signature Generation Rules
lessonId true Long Lesson ID

Example

http://api.polyv.net/hi-class-api/open/lesson/v1/getPlaybackVideo?appId=fyirmfdak4&timestamp=1638782295111&sign=4FFEE70C353D7F97F9D9057A8A72E453&lessonId=1015

Response Parameter Description

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure See Global Error Description
status String Response status text
error Error Error object See Global Error Description
data Array Empty on failure, response info on success See data field description

data Field Description

Parameter Type Description
lessonId Long Lesson ID
lessonName String Lesson name
firstImage String First frame screenshot
duration String Video duration, format HH:mm:ss
vid String Video ID
status Long Video status code
60/61: Published
10: Waiting for encoding
20: Encoding
40: Encoding failed
50: Waiting for review
51: Review failed
createTime String Video creation time yyyy-MM-dd HH:mm:ss
videoSize Long Video file size, unit: Bytes
playTimes String Play count
url String Video URL

Java Request Example

For quick integration of base code, please download the relevant dependency source code. Click to download source code. After downloading, add it to your own source project. HttpUtil.java and LiveSignUtil.java in the test cases are included in the download file.

    /**
     * 查询课节回放视频
     * @throws IOException
     * @throws NoSuchAlgorithmException
     */
    @Test
    public void getPlaybackVideo() throws IOException, NoSuchAlgorithmException {
        //公共参数,填写自己的实际参数
        String appId = super.appId;
        String appSecret = super.appSecret;
        String userId = super.userId;
        String timestamp = String.valueOf(System.currentTimeMillis());
        //业务参数
        String url = "https://api.polyv.net/hi-class-api/open/lesson/v1/getPlaybackVideo";
        String lessonId = "1015";

        //http 调用逻辑
        Map<String,String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp",timestamp);
        requestMap.put("lessonId",lessonId);
        requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
        String response = HttpUtil.get(url, requestMap);
        log.info("查询课节回放视频:{}",response);
        //do somethings
    }

Response Example

For system global error descriptions, see Global Error Description

Success Example

{
  "code": 200,
  "status": "success",
  "data": [
    {
      "lessonId": "1015",
      "lessonName": "课节1015",
      "firstImage": "//s1.videocc.net/default-img/small-class/default-cover.png",
      "duration": "00:00:36",
      "vid": "43f5f9caa2028deb711233444540e5964_4",
      "status": "61",
      "createTime": "2021-11-08 10:21:32",
      "videoSize": 1095207,
      "playTimes": "0",
      "url": "http://mpv.videocc.net/43f5f9caa2/4/43f5f9caa2028deb711233444540e5964_4.mp4"
    }
  ],
  "success": true
}

Error Example

{
  "code": 400,
  "status": "error",
  "error": {
    "code": 20012,
    "desc": "课节不存在"
  },
  "data": null,
  "success": false
}
联系客服,在线咨询