Polyv Help Center

Help Center

Query Player List (Legacy)

Updated: 2025-02-20 19:09:11

API Description

A new version of the player API is now available. It is recommended to use the new version: Query Player List

1、通过用户id,查询播放器列表
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议

API URL

http://api.polyv.net/v2/play/{userid}/player-list

Online API Call ``

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API 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 and obtain response data. See signature generation rules

Example

http://api.polyv.net/v2/play/1b448be323/player-list?sign=1E3CFEEC4EA888571A84156E5BF57EBB35ECAA72&ptime=1617845463779

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 additional error details
data Array Returns player list information on success See data field description, returns empty on failure

Data Field Description

Field Type Description
playerName String Player name
playerId String Player ID, e.g., "1b448be323"
date String Creation date, e.g., "2020-09-28 14:17:08"
isDefault Integer Whether it is the default player
1: Yes
0: No

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 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(VodVideoPlayerTest.class);

/**
 * 查询播放器列表
 */
@Test
public void testGetPlayerList() throws Exception, NoSuchAlgorithmException {
        //公共参数,填写自己的实际参数
        String secretKey = super.secretKey;
        String userId = super.userId;
        String ptime = String.valueOf(System.currentTimeMillis());
        //业务参数
        String url = "http://api.polyv.net/v2/play/" + userId + "/player-list";

        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("userid", userId);
        requestMap.put("ptime", ptime);
        requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
        String response = HttpUtil.get(url, requestMap);
        log.debug("测试查询播放器列表,{}", response);
        //do somethings
}

Response Example

For system global error descriptions, see Global Error Description

Success Example

{
  "code": 200,
  "status": "success",
  "message": "success",
  "data": [
    {
      "playerName": "默认播放器-红色",
      "playerId": "MDL7ARoayp",
      "date": "2021-04-02 11:53:44",
      "isDefault": 1
    },
    {
      "playerName": "创建的播放器",
      "playerId": "d4b8dDzXsT",
      "date": "2021-03-30 11:38:33",
      "isDefault": 0
    },
    {
      "playerName": "默认播放器",
      "playerId": "1b448be323",
      "date": "2020-09-28 14:17:08",
      "isDefault": 0
    }
  ]
}

Error Example

{
  "code": 400,
  "status": "error",
  "message": "sign can not be empty.",
  "data": ""
}
联系客服,在线咨询