Configures the live streaming latency.
Operation description
-
You can call this operation to configure the live streaming latency for a streaming domain.
-
The server-side cache stores an integer number of Groups of Pictures (GOPs). Therefore, the latency cannot be less than the GOP size. The actual latency depends on the GOP size. For example, if you set RtmpDelay to 4 seconds and the GOP size is 2 seconds, the minimum latency is 2 seconds (4 seconds - 2 seconds) and the maximum latency is 6 seconds (4 seconds + 2 seconds). If the GOP size is greater than the value of RtmpDelay, for example, if the GOP size is 5 seconds and RtmpDelay is 4 seconds, the latency fluctuates between 0 and 9 seconds.
-
Latency settings do not apply to audio-only streams. For these streams, the default latency is near zero.
-
For HTTP Live Streaming (HLS), the segment size is calculated by dividing the delay by 3 and rounding down. The minimum segment size is 1 second. The system then calculates the maximum number of segments. If the segment size is 3 seconds or more, the maximum number of segments is 4. Otherwise, the maximum is 6.
-
The actual HLS segment size cannot be smaller than the GOP size.
-
The HLS latency is calculated as: configured segment size × 3.
-
If you do not call this operation, the default latency applies. The default latency is 2 seconds for Real-Time Messaging Protocol (RTMP) streams and 4 seconds for Flash Video (FLV) streams. For HLS streams, the default segment size is 5 seconds. This results in a latency of 15 seconds and a maximum of 6 segments.
QPS limit
The queries per second (QPS) limit for a single user is 1,000. If you exceed this limit, the system triggers throttling, which can affect your business. Call this operation based on your business needs.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
live:SetLiveStreamDelayConfig |
update |
*Domain
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| DomainName |
string |
Yes |
example.com |
|
| HlsDelay |
integer |
No |
The streaming domain. |
4 |
| HlsLevel |
string |
No |
The delay for HTTP Live Streaming (HLS) playback, in seconds. Note
If this parameter is empty, the delay is set based on the HlsLevel parameter. |
short |
| FlvDelay |
integer |
No |
The HLS latency level. This parameter is ignored if HlsDelay is configured. Valid values:
Note
If both the HlsDelay and HlsLevel parameters are empty, the default value short is used. |
8 |
| FlvLevel |
string |
No |
The delay for FLV playback, in seconds. Note
If this parameter is empty, the delay is determined by the FlvLevel parameter. |
medium |
| RtmpDelay |
integer |
No |
The latency level for FLV playback. This parameter is ignored if the FlvDelay parameter is set. Valid values:
Note
If both the FlvDelay and FlvLevel parameters are empty, the default value short is used. |
4 |
| RtmpLevel |
string |
No |
The RTMP playback delay in seconds. Note
If this parameter is empty, the delay is determined by RtmpLevel. |
short |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The ID of the request. |
4C747C97-7ECD-4C61-8A92-67AD806331FF |
Examples
Success response
JSON format
{
"RequestId": "4C747C97-7ECD-4C61-8A92-67AD806331FF"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.