Polyv Help Center

Help Center

Modify Default Template Settings for Watch Page

Updated: 2024-09-25 10:26:58

API Description

1、修改观看页默认模板设置
2、接口支持https协议

API URL

http://api.polyv.net/live/v4/user/template/page-setting/update

Online API Call

Request Method

POST

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 details: Get Secret Key
sign true String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security and must not be stored or used directly on the client. 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
timestamp true String Current 13-digit millisecond timestamp, valid for 3 minutes
autoPlayEnabled false String Auto-play toggle, Y: Enable, N: Disable
barrageEnabled false String Barrage toggle, Y: Enable, N: Disable
barrageSpeed false String Barrage speed, 340: Slow, 270: Slower, 200: Standard, 130: Faster, 60: Fast
bookingEnabled false String WeChat booking toggle, Y: Enable, N: Disable
closePreviewEnabled false String Watch page toggle, Y: Hide watch page (only allow viewing via integrated SDK), N: Show watch page
flashPlayerEnabled false String Flash player toggle, Y: Enable, N: Disable
forbidFirefoxEnabled false String Block Firefox toggle, Y: Enable, N: Disable
mobileAudioEnabled false String Audio/video switch toggle, Y: Enable, N: Disable
mobilePvShowLocation false String View count display location on mobile, player: Player, desc: Live description
mobileWatchEnabled false String Mobile watch page toggle, Y: Enable, N: Disable
pvShowEnabled false String View count toggle, Y: Enable, N: Disable
recordingProtectEnabled false String Anti-popup player toggle, Y: Enable, N: Disable
showCountdownEnabled false String Show "Next Session" countdown in replay toggle, Y: Enable, N: Disable
switchPlayerEnabled false String Allow viewers to switch between H5 and Flash players, Y: Allow, N: Disallow; ineffective when Flash player toggle is N
viewerVerificationEnabled false String Viewer real-name verification toggle, Y: Enable, N: Disable
watchFeedbackEnabled false String Viewer complaint toggle, Y: Enable, N: Disable
watchLangType false String Watch page language, zh_CN: Chinese, en: English, follow_browser: Follow browser
watchLayout false String Watch page layout, ppt: PPT document, video: Video, only-video: Video only, followTeacher: Follow instructor
pictureInPictureEnabled false String Picture-in-picture toggle, Y: Enable, N: Disable

Example

http://api.polyv.net/live/v4/user/template/page-setting/update?autoPlayEnabled=N&mobileAudioEnabled=Y&watchFeedbackEnabled=Y&sign=5FB6EEFA7EB92B6D710A9E5889A8F405&barrageSpeed=60&switchPlayerEnabled=Y&pvShowEnabled=Y&showCountdownEnabled=Y&mobileWatchEnabled=Y&viewerVerificationEnabled=N&bookingEnabled=N&mobilePvShowLocation=player&appId=frlr1zazn3&closePreviewEnabled=Y&watchLayout=followTeacher&flashPlayerEnabled=N&barrageEnabled=Y&recordingProtectEnabled=N&forbidFirefoxEnabled=N&watchLangType=follow_browser&timestamp=1686884060082

Response Parameter Description

Parameter Type Description
code Integer Status code, same as HTTP status code, used to determine basic response status
data Object Data for successful response
error Object Error information when status code is not 200 See details: Error Parameter Description
requestId String Request ID, a unique UUID generated for each request, used only for troubleshooting and debugging, not for business logic
status String Response result, determined by business logic, returns success on success, error on failure
success Boolean Whether the response was successful

Error Parameter Description

Parameter Type Description
code Integer Error code, used to identify the specific error cause
desc String Error description, corresponds to error.code

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click here to download source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and LiveSignUtil.java, both contained in the download 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(getClass());
/**
* 修改观看页默认模板设置
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void pageSettingUpdateTest() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = super.appId;
    String appSecret = super.appSecret;
    String timestamp = String.valueOf(System.currentTimeMillis());

    //业务参数
    String url = "http://api.polyv.net/live/v4/user/template/page-setting/update";
    String autoPlayEnabled = "N";
    String barrageEnabled = "Y";
    String barrageSpeed = "60";
    String bookingEnabled = "N";
    String closePreviewEnabled = "Y";
    String flashPlayerEnabled = "N";
    String forbidFirefoxEnabled = "N";
    String mobileAudioEnabled = "Y";
    String mobilePvShowLocation = "player";
    String mobileWatchEnabled = "Y";
    String pvShowEnabled = "Y";
    String recordingProtectEnabled = "N";
    String showCountdownEnabled = "Y";
    String switchPlayerEnabled = "Y";
    String viewerVerificationEnabled = "N";
    String watchFeedbackEnabled = "Y";
    String watchLangType = "follow_browser";
    String watchLayout = "followTeacher";
    
    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("autoPlayEnabled", autoPlayEnabled);
    requestMap.put("barrageEnabled", barrageEnabled);
    requestMap.put("barrageSpeed", barrageSpeed);
    requestMap.put("bookingEnabled", bookingEnabled);
    requestMap.put("closePreviewEnabled", closePreviewEnabled);
    requestMap.put("flashPlayerEnabled", flashPlayerEnabled);
    requestMap.put("forbidFirefoxEnabled", forbidFirefoxEnabled);
    requestMap.put("mobileAudioEnabled", mobileAudioEnabled);
    requestMap.put("mobilePvShowLocation", mobilePvShowLocation);
    requestMap.put("mobileWatchEnabled", mobileWatchEnabled);
    requestMap.put("pvShowEnabled", pvShowEnabled);
    requestMap.put("recordingProtectEnabled", recordingProtectEnabled);
    requestMap.put("showCountdownEnabled", showCountdownEnabled);
    requestMap.put("switchPlayerEnabled", switchPlayerEnabled);
    requestMap.put("viewerVerificationEnabled", viewerVerificationEnabled);
    requestMap.put("watchFeedbackEnabled", watchFeedbackEnabled);
    requestMap.put("watchLangType", watchLangType);
    requestMap.put("watchLayout", watchLayout);

    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));

    url = HttpUtil.appendUrl(url, requestMap);
    String response = HttpUtil.postFormBody(url, null);

    log.info("测试修改观看页默认模板设置成功:{}", response);
    //do somethings

}

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "d2a25acab50240e1b344a1c045de36ae.67.16868840687251021",
    "data": null,
    "success": true
}

Error Example

{
    "code": 400,
    "status": "error",
    "requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
    "error": {
        "code": 20001,
        "desc": "application not found."
    },
    "success": false
}
联系客服,在线咨询
在线咨询