Polyv Help Center

Help Center

Query Recorded Videos

Updated: 2022-09-02 18:08:07

API Description

1、管理系统频道录制视频信息入口:云直播-我的直播-频道设置-回放管理-视频库-直播暂存
2、接口URL中的{channelId}为频道号
3、接口支持https协议

API URL

http://api.polyv.net/live/v2/channels/{channelId}/recordFiles

Online API Call

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

  2. The request parameters startDate and endDate must be passed together to query recorded video information within the specified time range.

  3. When sessionId is passed together with startDate and endDate, only sessionId is valid.

Request Parameters

Parameter Required Type Description
appId true String Account appId See details: Get Secret Key
timestamp true Long Current 13-digit millisecond timestamp, valid for 3 minutes
sign true String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must never 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 for response data. See details: Signature Generation Rules
userId true String POLYV user ID, same as on the Polyv official website. Path: Official Website -> Login -> Live Streaming (Developer Settings)
startDate false String Start date, format: yyyy-MM-dd
endDate false String End date, format: yyyy-MM-dd
sessionId false String Live streaming session ID

Example

http://api.polyv.net/live/v2/channels/2191541/recordFiles?appId=frlr1zazn3&sign=DABFF35FB3D25CAF37BB73F8944C2F44&userId=1b448be323&timestamp=1621840820088

Response Parameters

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure. See details: Global Error Description
status String Response status text
message String Response description. When code is 400 or 500, provides auxiliary error description.
data Array Empty on failure. Contains channel recorded video information on success. See details: Data Field Description

Data Field Description

Parameter Type Description
channelId String Channel ID
fileId String Recording file ID
url String Recording file URL. Returns MP4 preferentially; returns M3U8 if MP4 is unavailable.
startTime String Recording start time, format: yyyyMMddHHmmss
endTime String Recording end time, format: yyyyMMddHHmmss
fileSize Long Recording file size (in bytes)
duration Integer Duration (in seconds)
bitrate Integer Recording file bitrate (in bytes)
resolution String Resolution, e.g., 1280x720
channelSessionId String Live streaming session ID
fileName String Recording file name
daysLeft Integer Remaining days for the recording file. >0: remaining days, -1: permanent. Expired recording file records will not be returned.
origin String Recording file source
manual: Manual recording
auto: Automatic recording
originSessionId String Original live streaming session ID
When the recording file is 手动录制 or 自动录制, it equals the current live streaming session ID

Java Request Example

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

It is strongly recommended to use the Live Java SDK for API integration. The Live 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(ChannelPlayBackTest.class);
/**
 * 查询频道录制视频信息
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void testGetChannelRecordInfo() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = super.appId;
    String appSecret = super.appSecret;
    String userId = super.userId;
    String timestamp = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/live/v2/channels/%s/recordFiles";
    String channelId = "2139283";
    String startDate = "2020-01-01";
    String endDate = "2021-04-01";
    String sessionId = "fwmnnydr06";
    
    url = String.format(url, channelId);
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("userId", userId);
    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",
    "message":"",
    "data":[
        {
            "channelId":2191532,
            "fileId":"94ea693e1733389ae2e7693ebdacbd43",
            "url":"https://oss-live-1.videocc.net/record/record/recordf/1b448be323161536226913173df/2021-03-11-16-13-14_2021-03-11-16-15-07.mp4",
            "startTime":"20210311161313",
            "endTime":"20210311161507",
            "fileSize":9200637,
            "duration":114,
            "bitrate":0,
            "resolution":"1280x720",
            "channelSessionId":"fwmnnydr06",
            "fileName":"Spring 知识精讲1111",
            "daysLeft": 165,
            "origin": "auto",
            "originSessionId": "fwmnnydr06"
        }
    ]
}

Error Example

{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询
在线咨询