Configures the live streaming latency.
Operation description
- You can call this operation to configure the latency of a streaming domain.
- Because an integer number of groups of pictures (GOPs) are cached, the latency is not less than the GOP size. The actual latency is calculated based on the GOP size. For example, if RtmpDelay is set to 4 seconds and the GOP size is 2 seconds, the minimum latency is 2 seconds (4 seconds minus 2 seconds) and the maximum latency is 6 seconds (4 seconds plus 2 seconds). If the GOP size is greater than the value of RtmpDelay, for example, the GOP size is 5 seconds and RtmpDelay is set to 4 seconds, the latency ranges from 0 to 9 seconds.
- Configuration for the latency of an audio-only stream is invalid. By default, the latency is close to 0.
- For HTTP Live Streaming (HLS)-based playback, the segment size equals the latency divided by 3. Round the value down to the nearest integer. The value cannot be less than 1 second. Then, calculate the maximum number of segments. If the segment size is greater than or equal to 3 seconds, the maximum number of segments is 4. Otherwise, the maximum number of segments is 6.
- The actual HLS segment size is not smaller than the GOP size.
- The latency of HLS-based playback equals the configured segment size times 3.
- If you do not call this operation, the default latency is 2 seconds for Real-Time Messaging Protocol (RTMP)-based playback and 4 seconds for Flash Video (FLV)-based playback. By default, the size of an HLS segment is 5 seconds. In this case, the latency is 15 seconds and the maximum number of segments is 6.
QPS limit
You can call this operation up to 1,000 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this limit when you call this operation.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
live:SetLiveStreamDelayConfig | update | *Domain acs:cdn:*:{#accountId}:domain/{#DomainName} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
DomainName | string | Yes | The streaming domain. | example.com |
HlsDelay | integer | No | The latency of HLS-based playback. Unit: seconds. Note
If this parameter is left empty, the latency is set to a value corresponding to the HlsLevel parameter.
| 4 |
HlsLevel | string | No | The latency level of HLS-based playback. Ignore this parameter if the HlsDelay parameter is configured. Valid values:
Note
If both the HlsDelay and HlsLevel parameters are left empty, HlsLevel is set to short by default.
| short |
FlvDelay | integer | No | The latency of FLV-based playback. Unit: seconds. Note
If this parameter is left empty, the latency is set to a value corresponding to the FlvLevel parameter.
| 8 |
FlvLevel | string | No | The latency level of FLV-based playback. Ignore this parameter if the FlvDelay parameter is configured. Valid values:
Note
If both the FlvDelay and FlvLevel parameters are left empty, FlvLevel is set to short by default.
| medium |
RtmpDelay | integer | No | The latency of RTMP-based playback. Unit: seconds. Note
If this parameter is left empty, the latency is set to a value corresponding to the RtmpLevel parameter.
| 4 |
RtmpLevel | string | No | The latency level of RTMP-based playback. Ignore this parameter if the RtmpDelay parameter is configured. Valid values:
Note
If both the RtmpDelay and RtmpLevel parameters are left empty, RtmpLevel is set to short by default.
| short |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "4C747C97-7ECD-4C61-8A92-67AD806331FF"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|