How to Configure Transcoding Task Callbacks?

Overview

Upon completion of a transcoding task, AuroraCloud asynchronously sends task status and metadata to your designated endpoint via an HTTP POST request to the configured notify_url.

This guide details callback configuration, data protocol specifications, and parameter semantics.


Configuring the Callback Endpoint (Notify URL)

In the design of AuroraCloud, the callback address (notify_url) and the storage target (such as a S3 Bucket) are positioned at the same configuration level to fully accommodate the diverse business scenario needs of customers:

Binding a Callback During Storage Configuration

API Endpoint:

POST https://api.visionular.com/vodencoding/v1/add_storage

Request Body Example:

{
"region": "cn-zhangjiakou",
"type": "oss",
"bucket": "your-bucket-name",
"prefix": "custom/output/path",
"storage_ak": "LTAI5t5******EWduEV3Pja", // Replace with your Access Key
"storage_sk": "xqTJfWzDA******DFm9WOsBChCRF", // Replace with your Secret Key
"notify": "https://your-endpoint.com/transcode-callback" // Callback URL
}

Key Parameters:

  • notify: A publicly accessible HTTPS endpoint.

Callback Protocol Specifications

Request Method and Data Format

  • Method: POST

  • Content-Type: application/json

  • Body: JSON payload containing task status and metadata.

Callback Payload Example

{
"code": 0, // Global status code
"msg": "succeeded", // Aggregated status
"callback_url": "http://xxx.com/notify", // Redundant field (matches notify_url)
"data": [ // Task result array
{
"task_id": "20220420111542664667cccc3d179880",
"input": "https://input-source.com/test.mp4",
"output": "oss://output-bucket/path/test.mp4",
"format": "mp4", // Output format (mp4/hls/dash/flv)
"status": "succeeded", // Task status
"duration": 30.0, // Media duration (seconds)
"spend_time": 2.0 // Processing time (seconds)
},
{
"task_id": "20220420111542664667cccc3d179780",
"status": "failed", // Failed task example
"error_code": 1003, // Error code (if available)
"error_msg": "Invalid input file" // Error description (if available)
}
]
}

Parameter Semantics

ParameterTypeRequiredDescription
codeintYesGlobal status code (fixed to 0).
msgstringYesAggregated status:
succeeded– All tasks succeeded
failed – At least one task failed.dataJSON ArrayYesArray of task results (supports batch processing).
task_idstringYesUnique task identifier for logging and troubleshooting.
inputstringConditionalInput media URI (returned for successful tasks).
outputstringConditionalOutput file path (returned for successful tasks).
formatstringConditionalOutput format: mp4/hls/dash/flv (returned for successful tasks).
statusstringYesTask status: succeeded or failed.
durationfloatOptionalMedia duration in seconds (may be omitted for failed tasks).
spend_timefloatOptionalProcessing time in seconds.
error_codeintOptionalError code for failed tasks (e.g., 1003).
error_msgstringOptionalError description for failed tasks.

Server Response Requirements

  1. HTTP Status Code:
    • Return 200 OK; otherwise, AuroraCloud retries delivery (max 3 attempts, 5-second intervals).
  2. Response Body:
    • AuroraCloud ignores the body content. Return an empty body or simple acknowledgment (e.g., {"ack": true}).

Best Practices & Security Recommendations

  1. Idempotency: Use task_id to deduplicate potential retries.
  2. Validation: Verify request source IPs or enable signature headers (contact support for setup).
  3. Error Handling: Trigger alerts or remediation workflows for status=failed tasks using error_code.