All Products
Search
Document Center

ApsaraVideo Live:SetLiveStreamDelayConfig - Configure live streaming latency

Last Updated:Jun 06, 2025

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 multiplied by 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 limits

You can call this operation up to 1,000 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of this limit when calling this operation.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a RAM policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that support authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding ARN in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services. For more information, see Common condition keys.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

live:SetLiveStreamDelayConfig

update

*Domain

acs:cdn:*:{#accountId}:domain/{#DomainName}

None 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 empty, the latency is set based on 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:

  • short (default): indicates that the latency is 3 seconds.

  • medium: indicates that the latency is 6 seconds.

  • long: indicates that the latency is 15 seconds.

Note

If both the HlsDelay and HlsLevel parameters are empty, the default value short is used.

short

FlvDelay

integer

No

The latency of FLV-based playback. Unit: seconds.

Note

If this parameter is empty, the latency is set based on 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:

  • short (default): indicates that the latency is 2 seconds.

  • medium: indicates that the latency is 4 seconds.

  • long: indicates that the latency is greater than 4 seconds.

Note

If both the FlvDelay and FlvLevel parameters are empty, the default value short is used.

medium

RtmpDelay

integer

No

The latency of RTMP-based playback. Unit: seconds.

Note

If this parameter is empty, the latency is set based on 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:

  • short (default): indicates that the latency is 2 seconds.

  • medium: indicates that the latency is 4 seconds.

  • long: indicates that the latency is greater than 4 seconds.

Note

If both the RtmpDelay and RtmpLevel parameters are empty, the default value short is used.

short

Response parameters

Parameter

Type

Description

Example

object

RequestId

string

The request ID.

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.