All Products
Search
Document Center

ApsaraVideo Live:SetLiveStreamDelayConfig

Last Updated:Nov 14, 2024

Configures the live streaming latency.

Operation description

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 limits.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
live:SetLiveStreamDelayConfigupdate
*Domain
acs:cdn:*:{#accountId}:domain/{#DomainName}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DomainNamestringYes

The streaming domain.

example.com
HlsDelayintegerNo

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
HlsLevelstringNo

The latency level of HLS-based playback. Ignore this parameter if the HlsDelay parameter is configured.

Valid values:

  • short: The latency is 3 seconds. This is the default value.
  • medium: The latency is 6 seconds.
  • long: The latency is 15 seconds.
Note If both the HlsDelay and HlsLevel parameters are left empty, HlsLevel is set to short by default.
short
FlvDelayintegerNo

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
FlvLevelstringNo

The latency level of FLV-based playback. Ignore this parameter if the FlvDelay parameter is configured.

Valid values:

  • short (default): The latency is 4 seconds.
  • medium: The latency is 8 seconds.
  • long: The latency is 16 seconds.
Note If both the FlvDelay and FlvLevel parameters are left empty, FlvLevel is set to short by default.
medium
RtmpDelayintegerNo

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
RtmpLevelstringNo

The latency level of RTMP-based playback. Ignore this parameter if the RtmpDelay parameter is configured.

Valid values:

  • short (default): The latency is 4 seconds.
  • medium: The latency is 8 seconds.
  • long: The latency is 16 seconds.
Note If both the RtmpDelay and RtmpLevel parameters are left empty, RtmpLevel is set to short by default.
short

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

4C747C97-7ECD-4C61-8A92-67AD806331FF

Examples

Sample success responses

JSONformat

{
  "RequestId": "4C747C97-7ECD-4C61-8A92-67AD806331FF"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history