Callback Notification

Last update:2023-12-27 17:29:20

Notification Security Mechanism

To ensure secure notification delivery, we include an Authorization field in the notification request header. This field allows you to authenticate the notification and prevent unauthorized access. Formatted as:

<Accesskey>:URLSAFE_BASE64(HMAC_SHA1(NotifyUrlWithOutQuery + "\n" + NotifyBody,SecretKey))

Note:
1. NotifyBody refers to the content of the received notification…
2. A valid pair of AccessKey (AK) and AccessKey Secret (SK) from your account is selected randomly to generate the Authorization value for the header. Hence, for authenticating callback notifications, you need to keep a record of all Access Keys and Access Key Secrets associated with your account and match the Access Key used in the notification request for authentication.

Notification Explanation

Once the notification address NotifyUrl is set, this address will receive a JSON-formatted NotifyBody information. This information is a URL-safe Base64-encoded representation of the processing results for your media processing tasks. The specific information included is detailed in the following table.

The callback URL must be accessible to the public internet and capable of responding with an HTTP/1.1 200 OK status to our servers after receiving a callback notification.

Field Name Type Description
id string The persistentId of your media processing task.
code int Task status and progress.
1 - Some tasks are still running, while others have completed.
2 - Some tasks have encountered errors, while others are completed or still in progress.
3 - All tasks are successful.
desc string Detailed description corresponding to the status code.
separate string Type of the notification.
0 - This is a one-time notification.
1 - This is just one of the separate notifications.
inputkey string Original file name.
inputbucket string The bucket where the original file is located.
inputfsize int Original file size.
items array Status information for each operation. If the processing request includes multiple operations, the items contain multiple pieces of information.
cmd string Operation command (fops).
code string Processing result status code.
2 - Failed.
3 - Successful.
costTime int Transcoding time spent, defaulting to 0.
desc string Detailed description corresponding to the status code.
error string If processing fails, this field lists the specific reasons.
fsize int Size of the output video/audio.
hash string Hash value of the result.
key string Key value of the processing result, formatted as bucketName:key.
url string Access path to the transcoded video/audio.
duration double Duration of the transcoded video/audio.
bit_rate string Bitrate of the transcoded video/audio.
resolution string Resolution of the transcoded video.
detail array Details for each video/audio when there are multiple outputs.
fsize int Size of the transcoded video/audio. If the output video format is m3u8, this field represents the size of the m3u8 manifest.
tssize int If the output video format is m3u8, it represents the total size of ts files; if the output video format is non-m3u8, this field is 0.

Example

{
    "id":"2c90802745ee87870145ef1430f90006",
    "code":3,
    "desc": "operate ["avthumb/flv"] is finish",
    "separate":0,
    "inputkey":"aaa.flv",
    "inputbucket":"chenqltesttwo",
    "inputfsize":20000,
    "items":[
        {
            "cmd":"avthumb/flv",
            "code":"3",
            "costTime": 0,
            "desc":"finish",
            "error":null,
            "fsize":20000,
            "hash":"FlWvHsc-CK6miygKCcLjCaQ5csNO",
            "key":"chenqltesttwo:aaa.flv",
            "url":"http://chenqltesttwo.com/aaa.flv",
            "duration": 198.083,
            "bit_rate": "1288025",
            "resolution": "1280X720",
            "detail": [
            {
                "fsize": 20000,
                "tssize":1024,
                "hash": "FlWvHsc-CK6miygKCcLjCaQ5csNO",
                "key": "chenqltesttwo:aaa.flv",
                "url": "http://chenqltesttwo.com/aaa.flv",
                "duration": 198.083,
                "bit_rate": "1288025",
                "resolution": "1280X720",
            }
                    ]
        }
    ]
}
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!