Polyv Help Center

Help Center

POLYV Web Upload Plugin (V1.0)

Updated: 2024-12-16 19:20:19

To use the POLYV Web Upload Plugin, first create an upload button on the page.

Next, reference the POLYV Web Upload Plugin's JS, initialize the upload parameters, and create a new upload instance. Upload parameter explanation: cataid: Upload directory ID; luping: Enable video courseware optimization, which improves clarity for uploaded screen recording videos; state: Custom parameter, can be retrieved via the callback notification interface; keepsource: Play the source file (do not encode the source file).


The value of hash is calculated by MD5 hashing the string formed by concatenating the 13-digit millisecond timestamp and the writeToken in order, for example:

The value of sign is calculated by MD5 hashing the string formed by concatenating the secretkey and the 13-digit millisecond timestamp in order, for example:


Since the timestamp is valid for 3 minutes, to avoid being unable to use the upload plugin on the same page after staying for more than 3 minutes, the client page needs to refresh and obtain the latest ts, hash, and sign values every 3 minutes, and call the plugin's update method to update the data.

// Frontend JS fetches the latest ts, hash, sign from reload.php every 3 minutes
// And updates the data via the upload plugin's update method
// Server-side reload.php source code example, outputs ts, sign, hash values


({
ts:'',
sign:'',
hash:''
});

If you need to display the response information returned by the server on the frontend page, you can click "Upload" -> "Video List" -> "Return Video Info" to trigger the response event. You need to add the response event parameter in the initialization upload parameters and add the corresponding text box element on the page. If you also need to automatically close the popup when clicking the "Return Video Info" button, you can add the upload.closeWrap() method.

var obj = {
    response: function(json) {  
        var scriptdata = "