All Products
Search
Document Center

ApsaraVideo Live:SetLiveStreamDelayConfig

Last Updated:Dec 17, 2025

You can call SetLiveStreamDelayConfig to configure live streaming latency.

Operation description

  • This operation configures the 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 is estimated based on the GOP size. For example, if you set RtmpDelay to 4 seconds for an RTMP stream and the GOP size is 2 seconds, the actual latency ranges from 2 seconds (4 - 2) to 6 seconds (4 + 2). If the GOP size is larger than the configured RtmpDelay, for example, GOP = 5 seconds and RtmpDelay = 4 seconds, the latency fluctuates between 0 and 9 seconds.

  • Latency configurations do not take effect for audio-only streams. The default latency is close to 0 seconds.

  • For an HLS configuration, the segment size is calculated as `Delay / 3` and rounded down to the nearest integer. The minimum segment size is 1 second. The maximum number of segments is 4 if the segment size is 3 seconds or more. Otherwise, the maximum is 6 segments.

  • 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 system uses the default values. The default latency is 2 seconds for RTMP and 4 seconds for FLV. For HLS, the default segment size is 5 seconds, which results in a latency of 15 seconds with a maximum of 6 segments.

Queries per second (QPS) limit

The QPS limit for this operation is 1,000 calls per second per user. If you exceed this limit, API calls are throttled, which may affect your business. Plan your calls accordingly.

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 Resource Access Management (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 supports 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 Alibaba Cloud Resource Name (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.

  • 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

RegionId

string

No

The region ID.

cn-shanghai

DomainName

string

Yes

The streaming domain.

example.com

HlsDelay

integer

No

The HLS playback latency. Unit: seconds.

Note

If this parameter is left empty, the latency is set based on the value of HlsLevel.

4

HlsLevel

string

No

The HLS latency level. This parameter is ignored if HlsDelay is set.

Valid values:

  • short (default): 3 seconds.

  • medium: 6 seconds.

  • long: 15 seconds.

Note

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

short

FlvDelay

integer

No

The FLV playback latency. Unit: seconds.

Note

If this parameter is left empty, the latency is set based on the value of FlvLevel.

8

FlvLevel

string

No

The FLV latency level. This parameter is ignored if FlvDelay is set.

Valid values:

  • short (default): 2 seconds.

  • medium: 4 seconds.

  • long: more than 4 seconds.

Note

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

medium

RtmpDelay

integer

No

The RTMP playback latency. Unit: seconds.

Note

If this parameter is left empty, the latency is set based on the value of RtmpLevel.

4

RtmpLevel

string

No

The RTMP latency level. This parameter is ignored if RtmpDelay is set.

Valid values:

  • short (default): 2 seconds.

  • medium: 4 seconds.

  • long: more than 4 seconds.

Note

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

short

Response elements

Element

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.