Polyv Help Center

Help Center

Query Channel Live Recording List

Updated: 2024-08-26 15:59:15

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 channel recording video information within a time range.

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

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See details for obtaining 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 saved 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 and obtain response data. See signature generation rules
userId true String POLYV user ID, consistent with the POLYV official website. Path: Official Website -> Login -> Live Streaming (Development Settings)
startDate false String Start date, format: yyyy-MM-dd
endDate false String End date, format: yyyy-MM-dd
sessionIds false String Live session IDs, multiple IDs separated by commas

Example

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

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
message String Response description, assists in describing error reasons when code is 400 or 500
data Array Empty on request failure; contains channel recording video information on success See data field description

data Field Description

Parameter Type Description
channelId String Channel ID
fileId String Recording file ID
url String Recording file URL, MP4 is preferred; if MP4 is unavailable, M3U8 is returned
startTime String Recording start time, format: yyyyMMddHHmmss
endTime String Recording end time, format: yyyyMMddHHmmss
fileSize Long Recording file size (unit: bytes)
duration Integer Duration (unit: seconds)
bitrate Integer Recording file bitrate (unit: bytes)
resolution String Resolution, example: 1280x720
channelSessionId String Live session ID
fileName String Recording file name
daysLeft Integer Remaining days for the recording file. Greater than 0: remaining days; -1: permanent. Expired recording file records are not returned.
origin String Recording file source
manual: Manual recording
auto: Automatic recording
merge: Merged
clip: Clipped
smart-clip: Smart clipping
originSessionId String Original live session ID
When the recording file is 手动录制 or 自动录制, it equals the current live session ID
When the recording file is 合并 or 裁剪, it is the original live session ID
recordFileType String Recording file type
complete: Complete replay
part: Automatic recording_segment
merge: Manual merge
clip: Clip
subtitleList Array Replay subtitle list See subtitleList parameter description

subtitleList Parameter Description

Parameter Type Description
id Long Subtitle ID
name String Subtitle file name
srtUrl String Subtitle file URL
language String Subtitle language
status String Subtitle status, publish--displayed, finish--not displayed

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 project. The test cases include HttpUtil.java and LiveSignUtil.java 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 sessionIds = "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-wide 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": ""
}
联系客服,在线咨询