Configures the live streaming latency.
Usage notes
- 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 HLS-based playback, the segment size equals to 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 to the configured segment size times 3.
- If you do not call this operation, the default latency is 2 seconds for RTMP-based playback and 4 seconds for 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. For more information, see QPS limit on an API operation in ApsaraVideo Live.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | SetLiveStreamDelayConfig |
The operation that you want to perform. Set the value to SetLiveStreamDelayConfig. |
RegionId | String | No | cn-shanghai |
The ID of the region where the streaming domain resides. |
DomainName | String | Yes | example.com |
The streaming domain. |
HlsDelay | Integer | No | 4 |
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.
|
HlsLevel | String | No | short |
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.
|
FlvDelay | Integer | No | 8 |
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.
|
FlvLevel | String | No | medium |
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.
|
RtmpDelay | Integer | No | 4 |
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.
|
RtmpLevel | String | No | short |
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.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 4C747C97-7ECD-4C61-8A92-67AD806331FF |
The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=SetLiveStreamDelayConfig
&DomainName=example.com
&HlsDelay=4
&FlvDelay=8
&RtmpDelay=4
&Common request parameters
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<SetLiveStreamDelayConfigResponse>
<RequestId>4C747C97-7ECD-4C61-8A92-67AD806331FF</RequestId>
</SetLiveStreamDelayConfigResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "4C747C97-7ECD-4C61-8A92-67AD806331FF"
}
Error codes
For a list of error codes, visit the API Error Center.
HttpCode |
Error code |
Error message |
Description |
---|---|---|---|
500 |
Internal |
The request processing has failed due to some unknown error. |
The error message returned because an unknown error occurred. |
404 |
InvalidDomain.NotFound |
The domain provided does not exist in our records. |
The error message returned because the domain name was not found under your Alibaba Cloud account. |
403 |
IllegalOperation |
Illegal domain operate is not permitted. |
The error message returned because the current operation is not supported. For example, the specified domain name is not a streaming domain. |
400 |
InvalidNotifyUrl.Malformedl |
Specified parameter NotifyUrl is not valid. |
The error message returned because the HTTP URL is invalid. |
400 |
InvalidNotifyUrl.Unsafel |
Specified NotifyUrl is not safe. |
The error message returned because the URL used to receive notifications is unsafe. |