Recording File Generated Callback
Description
When developers need to implement live replay functionality, after enabling background recording, when a stream is recorded on the CDN, the APP will make a POST request to the callback URL.
Callback instructions
- Request method: POST.
The callback data format is JSON. You need to perform UrlDecode decoding on it.
- Request URL: Please configure the callback URL on the ZEGOCLOUD Console.
- Transfer protocol: HTTPS/HTTP. HTTPS is recommended.
Callback parameters
| Parameter | Type | Description |
|---|---|---|
| stream_alias | String | Stream name, corresponds to the client's StreamID, not exceeding 255 bytes. |
| replay_url | String | Replay URL, not exceeding 1024 bytes. |
| begin_time | String | Start time, Unix timestamp. |
| end_time | String | End time, Unix timestamp. |
| timestamp | String | Server current time, Unix timestamp. |
| nonce | String | Random number. |
| signature | String | Verification string. For details, see Callback instructions - Verification instructions. |
| appid | String | AppId. |
| event | String | Callback event. This callback returns record. |
| extra_params | String | Extended field. Different CDN vendors have different extended fields. Please refer to the table below. |
When using CDN services from different vendors, the extra_params parameter is as follows:
| CDN vendor | extra_params parameter | Type | Description |
|---|---|---|---|
| Tencent | TaskId | String | Unique identifier of the recording task. |
| FileID | String | Unique identifier of the recording file. | |
| Duration | Float | Recording duration. | |
| Ws | PersistentId | String | Unique identifier of the recording. |
| Duration | Float | Recording duration. | |
| Huawei | Duration | Float | Duration of the recording file, unit: seconds. |
| ObsObject | String | OBS storage path of the recording file. | |
| FileSize | UInt32 | File size, unit: Byte. |
Data example
{
"stream_alias": "aaaa",
"replay_url": "replay_url",
"begin_time": "1481597358",
"end_time": "1481597358",
"timestamp": "1481597358",
"nonce": "158273",
"signature": "signature",
"appid": "1",
"event": "record",
"extra_params": "extra_params"
}Return response
Return HTTP status code 2XX (e.g., 200) indicates success, and other responses indicate failure.
Callback retry strategy
If the ZEGO server does not receive a response, or the received HTTP status code is not 2XX (e.g., 200), it will attempt to retry, up to 5 retries. The interval between each retry request and the previous request is 2s, 4s, 8s, 16s, and 32s respectively. If the 5th retry still fails, no more retries will be made, and the callback will be lost.
