If you require notification of successful file transcoding, contact ZEGOCLOUD Technical Support to configure a callback URL. Then, the file transcoding server will send a request to the callback URL in POST mode.
Parameter | Type | Description |
---|---|---|
appid |
Number |
App ID. |
event |
String |
Callback event. The return value is cvt_finish. |
nonce |
String |
String of random digits. |
signature |
String |
Verification string. For details, see Verification description. |
timestamp |
Number |
Current time of the server (Unix timestamp). |
data |
Object |
Response object. For details, see Data member list. |
The following table lists data members.
Parameter | Type | Description |
---|---|---|
file_id |
String |
File ID returned after successful transcoding. |
task_id |
String |
File transcoding task ID. |
status |
Number |
File transcoding status. For details, see the following table of status description. |
The following table lists the values of Status.
Status code | Description |
---|---|
16 | Transcoding succeeded. |
32 | Transcoding failed. |
64 | Transcoding task canceled. |
128 | Password-protected file. |
256 | The file is too large. |
512 | The Excel file contains too many sheets. |
1024 | The file is empty. For example, the PowerPoint file contains no slide. |
2048 | The transcoding server failed to open the file. |
4096 | The target file type is not supported. |
8192 | The source file is read-only. |
16384 | The transcoding server failed to download the source file. The possible causes are as follows:
|
32768 | Elements that cannot be processed by transcoding tools detected in the source file, such as ink marks and graffiti. Remove the elements and transcode the file again. |
32769 | The file format of the Word, Excel, or PowerPoint file is invalid. Ensure that the source file can be opened by Office before transcoding the file. |
{
"appid": 123,
"data": {
"file_id": "ZYV-AFTrF6qnfFGW",
"status": 16,
"task_id": "9Y74yTsVd7e825-N"
},
"event": "cvt_finish",
"nonce": "6990248315071153368",
"signature": "1bb4db39726ee7f64c20ac0a71a730655b98ae2c",
"timestamp": 1627544014
}
To improve data security, the developer performs local signature calculation after receiving the callback from the ZEGO server and compares obtained signature with the file signature to determine whether the request is valid.
The encryption and verification flows are as follows:
The following table lists the parameters.
Parameter | Description |
---|---|
callbacksecret | Verification key on the server. The verification key is generated when a project is registered on the ZEGOCLLOUD console, and you can select Console > Project Configuration > Server-End API Key to view the key. |
timestamp | Unix timestamp. |
nonce | Random number. |
Refer to the following sample code for how to generate and verify the callback request signature.
// Obtain signature, timestamp, and nonce from request parameters.
$signature = $_POST["signature"];
$timestamp = $_POST["timestamp"];
$nonce = $_POST["nonce"];
$secret = callbacksecret;// Callback secret obtained from the background.
$tmpArr = array($secret, $timestamp, $nonce);
sort($tmpArr, SORT_STRING);
$tmpStr = implode( $tmpArr );
$tmpStr = sha1( $tmpStr );
if( $tmpStr == $signature ){
return true;
} else {
return false;
}
// Obtain signature, timestamp, and nonce from request parameters.
String signature = request.getParameter("signature");
long timestamp = request.getParameter("timestamp");
String nonce = request.getParameter("nonce");
// Callback secret obtained from the background.
String secret = callbacksecret;
String[] tempArr = {secret, ""+timestamp, nonce};
Arrays.sort(tempArr);
String tmpStr = "";
for (int i = 0; i < tempArr.length; i++) {
tmpStr += tempArr[i];
}
tmpStr = org.apache.commons.codec.digest.DigestUtils.sha1Hex(tmpStr);
return tmpStr.equals(signature);
$timestamp = 1470820198;
$nonce = 123412;
$secret = 'secret';
The original string to be encrypted after sequencing and splicing is 1234121470820198secret.
The encrypted result is 5bd59fd62953a8059fb7eaba95720f66d19e4517.
If the HTTP status code is 2XX (for example, 200)" is returned, the callback succeeded. Otherwise, the callback failed.
If the ZEGOCLOUD server receives no response, a callback will be initiated again after 15 seconds. Callback can be retried at most twice.