Polyv Help Center

Help Center

Query Channel Information

Updated: 2022-09-29 15:04:48

API Description

1、查询直播频道信息
2、接口URL中的{channelId}为频道号
3、接口支持https协议

API URL

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

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 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 saved or used directly on the client side. All APIs must be called through your own server to relay requests to the POLYV server and retrieve response data. See Signature Generation Rules

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 Object Empty on failure. Contains channel information on success See data field description

data Field Description

Parameter Type Description
channelId String Live channel ID
userId String Live user ID
name String Live channel name
description String Live channel description
url String Live push stream URL
stream String Live stream name
logoImage String Player logo
logoOpacity Float Logo opacity, 1 means fully opaque
logoPosition String Logo position
logoHref String Logo click-through link
coverImage String Cover image displayed before playback
coverHref String Cover image click-through link
waitImage String Image displayed while waiting for stream
waitHref String Wait image click-through link
cutoffImage String Image displayed when stream is cut off
cutoffHref String Cutoff image click-through link
advertType String Ad type
advertDuration Integer Ad duration
advertWidth Integer Ad area width
advertHeight Integer Ad area height
advertImage String Image ad
advertHref String Ad click-through link
advertFlvVid String Video ad ID
advertFlvUrl String Video ad URL
playerColor String Player control bar color
autoPlay Boolean Auto play
warmUpFlv String Initial warm-up video
passwdRestrict Boolean Viewing password restriction, requires password to play stream
passwdEncrypted String Encrypted viewing password
isOnlyAudio String Audio-only stream, Y: enabled, N: disabled
isLowLatency String Low latency, Y: enabled, N: disabled
channelLogoImage String Channel icon
publisher String Host name
scene String Live scene
alone: Event live
topclass: Large class
ppt: Three-screen
seminar: Seminar
channelViewerPasswd String Participant password
channelPasswd String Channel password
linkMicLimit Integer Channel max simultaneous connections
-1: Use account limit
0-16: Specific number
streamType String Stream type
client: Client push
pull: Pull stream
thirdpull: Third-party pull
disk: Pseudo-live
audio: Audio live
pureRtcEnabled String No-delay live switch, Y: enabled, N: disabled
type String Channel type
transmit: Relay source
normal: Normal channel
receive: Relay receiver
cnAndEnLiveEnabled String Chinese/English live room switch, Y: enabled, N: disabled
pushEnUrl String English push stream URL
categoryId String Category ID
categoryName String Category name
currentTimeMillis Long Server 13-digit millisecond timestamp

Java Request Example

For quick integration, download the relevant dependency source code. Click to download source code. After downloading, add it to your 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(ChannelOperateTest.class);
/**
 * 查询频道信息
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void testGetChannelDetail() 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/get";
    String channelId = "2139283";
    
    url = String.format(url, channelId);
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.get(url, requestMap);
    log.info("测试查询频道信息,返回值:{}", response);
    //do somethings
    
}

Response Example

For global error descriptions, see Global Error Description

Success Example

{
    "code":200,
    "status":"success",
    "message":"",
    "data":{
        "channelId":2139283,
        "userId":"1b448be323",
        "name":"API讨论",
        "publisher":"主持人",
        "description":"",
        "url":"rtmp://push-d1.videocc.net/recordf/1b448be3231612574447801d3db?auth_key=1615187853-0-0-a389e65ee28cdbfe0388cdbba8097ca3",
        "stream":"1b448be3231612574447801d3db",
        "logoImage":"",
        "logoOpacity":1,
        "logoPosition":"tr",
        "logoHref":"",
        "coverImage":"",
        "coverHref":"",
        "waitImage":"",
        "waitHref":"",
        "cutoffImage":"",
        "cutoffHref":"",
        "advertType":"NONE",
        "advertDuration":0,
        "advertWidth":0,
        "advertHeight":0,
        "advertImage":"",
        "advertHref":"",
        "advertFlvVid":"",
        "advertFlvUrl":"",
        "playerColor":"#666666",
        "autoPlay":false,
        "warmUpFlv":"",
        "passwdRestrict":false,
        "passwdEncrypted":"",
        "isOnlyAudio":"N",
        "isLowLatency":"N",
        "m3u8Url":"http://pull-d1.videocc.net/recordf/1b448be3231612574447801d3db.m3u8?auth_key=1615186053-0-0-c9c2c9b09b982e9fe357ecf6461ef532",
        "m3u8Url1":"",
        "m3u8Url2":"",
        "m3u8Url3":"",
        "channelLogoImage":"http://liveimages.videocc.net/assets/wimages/pc_images/logo.png",
        "scene":"alone",
        "channelViewerPasswd":null,
        "channelPasswd":"xxxx",
        "linkMicLimit":16,
        "streamType":"client",
        "pureRtcEnabled":"Y",
        "type":"transmit",
        "cnAndEnLiveEnabled":"N",
        "pushEnUrl":null,
        "categoryId":340019,
        "categoryName":"默认分类",
        "currentTimeMillis":1615186053464
    }
}

Error Example

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