All Products
Search
Document Center

ApsaraVideo Live:Reduce streaming latency to 200–400 ms

Last Updated:Jun 20, 2026

This topic describes how to use Real-Time Streaming (RTS) to reduce live streaming latency to under 400 ms and provide viewers with a smooth, real-time viewing experience.

Overview

The live streaming solution is built on Alibaba Cloud's Global Realtime Transport Network (GRTN). It uses the WebRTC protocol to achieve an end-to-end latency of 200–400 ms. This solution also seamlessly integrates with standard live streaming for forward compatibility.

image

Achieve an end-to-end latency of 200–400 ms with RTS:

  1. A streamer captures the live content and uses the Push SDK to ingest the stream to the nearest Alibaba Cloud point of presence (POP) over the WebRTC protocol.

  2. The stream is transmitted in real time across the 3,200+ nodes in GRTN using intelligent routing and Quality of Service (QoS) technologies.

  3. Viewers pull the stream from the nearest Alibaba Cloud point of presence (POP) over the WebRTC protocol for playback, achieving an end-to-end latency of 200–400 ms.

(Optional) Enable stream relay to support media processing, RTS, and standard live streaming:

  1. After you enable stream relay, ApsaraVideo Live automatically transmuxes the ingested stream to generate an RTMP stream.

  2. You can configure media services for this stream, such as transcoding, recording, and snapshot capture.

  3. If you want to maintain low-latency stream pull, you can use RTS. Viewers can still pull the stream over WebRTC to get an end-to-end latency of 400–800 ms.

  4. If you want to use standard live streaming, you can pull the stream for playback using protocols such as RTMP, FLV, and HLS.

Implementation

Prerequisites

  • You have activated the ApsaraVideo Live service. For more information, see Activate ApsaraVideo Live.

  • You have configured ingest and streaming domains. For more information, see the "Add an ingest domain and a streaming domain", "Configure a CNAME record", and "Associate an ingest domain with a streaming domain" sections in Get started with ApsaraVideo Live.

Configure HTTPS certificates for domains

This topic uses a browser-based demo for stream ingest and pull. WebRTC in browsers requires HTTPS for security. Therefore, you must configure HTTPS certificates for your ingest and streaming domains. For instructions, see Configure HTTPS secure acceleration.

If you use a native SDK for stream ingest and playback, you do not need to configure HTTPS certificates.

Enable Real-Time Streaming (RTS)

  1. Log on to the ApsaraVideo Live console.

  2. In the left-side navigation pane, click Live +> RTS.

  3. Select a streaming domain.

  4. Turn on the RTS switch and select Half-second latency (end-to-end latency 200–400 ms).

After you select Half-second latency, only stream ingest and playback over the ARTC protocol is supported. Standard live streaming, stream ingest over RTMP, and cloud features such as transcoding and recording are disabled for the current streaming domain.

Generate ingest and playback URLs

Method 1: Generate URLs in the console

After you enable RTS, you can go to the streaming testing tool and click Generate URLs. Enter an AppName and StreamName to generate ARTC-based RTS ingest and playback URLs.

On the configuration page, select a streaming domain and its associated ingest domain. In the Latency goal section, select sub-second latency (end-to-end latency: 400–800 ms) or Half-second latency (end-to-end latency: 200–400 ms). If you require HTTPS playback, ensure that you have configured an SSL certificate and the Access-Control-Allow-Origin response header. Both the generated ingest URL and playback URL start with artc://.

Method 2: Manually assemble URLs

To manually assemble URLs, gather the following: ingest domain, streaming domain, AppName, StreamName, transcoding template ID (if applicable), and authentication string (if applicable).

URL type

URL format

Assembly rule

Ingest URL

Supports RTMP, RTS, and SRT. We recommend using RTMP for ingest. Example:

RTMP: rtmp://demo.aliyundoc.com/app/stream?auth_key={authentication_string}

Note

RTS supports pulling streams using URLs in RTS format.

Ingest domain + AppName + StreamName + Authentication string

Streaming URL

Supports RTMP, FLV, M3U8, and RTS. We recommend that you use RTS for playback. Example:

RTS: artc://example.aliyundoc.com/app/stream?auth_key={authentication_string}

Streaming domain + AppName + StreamName + Authentication string

Transcoded stream URL

Note

If you use a transcoding template, you must assemble the streaming URL using this format.

Supports RTMP, FLV, M3U8, and RTS. We recommend that you use RTS for playback. Example:

RTS: artc://example.aliyundoc.com/app/stream_{transcoding_template_id}?auth_key={authentication_string}

Streaming domain + AppName + StreamName_Transcoding template ID + Authentication string

Note
  • For associated ingest and streaming domains, you can ingest and play streams as long as the AppName and StreamName are the same for both.

  • A transcoded stream URL requires a transcoding template. Find the template ID in the console. Live stream transcoding.

  • The authentication string (auth_key) is generated by an MD5 authentication algorithm. URL authentication must be enabled. Components of an authenticated URL.

  • Replace {transcoding_template_ID} or {authentication_string} with the actual data, and omit the curly braces {} from the final URL.

Ingest the RTS stream

Integrate one of the following Push SDKs:

RTS Push SDK

References

Push SDK for iOS

Push SDK for iOS

Note

The Push SDK for iOS supports WebRTC-based stream ingest by default.

Push SDK for Android

Push SDK for Android

Note

The Push SDK for Android supports WebRTC-based stream ingest by default.

Use OBS for stream ingest over the WHIP protocol

OBS RTS stream ingest

The following steps describe how to use the web demo for RTS stream ingest:

  1. Go to the RTS web demo for stream ingest.

  2. In the demo, select the Stream ingest mode.

  3. From the none drop-down list, select camera or screen based on your needs.

    If you select camera, click the Microphone and Camera buttons to grant the required browser permissions. After you grant the permissions, select your devices from the microphone and camera drop-down lists.

  4. Enter the RTS ingest URL that you generated in the Generate ingest and playback URLs step and click Create Local Stream.

  5. Click Start to begin the stream ingest.

Play the RTS stream

Integrate one of the following ApsaraVideo Player SDKs:

RTS Player SDK

References

ApsaraVideo Player SDK for Web

Web player

ApsaraVideo Player SDK for iOS

iOS player

ApsaraVideo Player SDK for Android

Android player

ApsaraVideo Player SDK for Flutter

Flutter player

ApsaraVideo Player SDK for Windows

Note

To obtain the ApsaraVideo Player SDK for Windows, contact our sales team.

The following steps describe how to use the web demo for RTS playback:

  1. Go to the RTS web demo for playback.

  2. In the demo, select the Stream pull mode.

  3. Enter the RTS playback URL that you generated in the Generate ingest and playback URLs step.

  4. Click Start.

(Optional) Configure stream relay

  1. On the RTS settings page, select Half-second latency (end-to-end latency 200–400 ms).

  2. Click Configure Stream Relay, turn on the switch, and select another ingest domain to receive the relayed RTMP stream.

Note

For example, the destination ingest domain is push.example.com, and its associated streaming domain is pull.example.com.

  • The RTS Half-second latency mode cannot be enabled for the destination ingest domain or its associated streaming domain.

  • No fees are charged for internal stream relay.

(Optional) Configure media services for relayed streams

After you configure stream relay, you can configure media processing templates for the streaming domain (pull.example.com) that is associated with the destination ingest domain.

In the left-side navigation pane of the ApsaraVideo Live console, click Feature Management and select the features that you want to configure.

The Feature Management section includes configuration items for features such as Live Recording, Live Transcoding, Live Watermark, Live Snapshot Capture, Live Time Shifting, Content Moderation, Live Packaging, Real-time Subtitles (public preview), Edge Transcoding, DRM Management, Callback Management, and Stream Pull and Relay.

(Optional) Play relayed stream with standard protocols

After the stream is relayed, you can use the streaming domain (pull.example.com) that is associated with the destination ingest domain to play the original or transcoded stream using standard live streaming (RTMP, FLV, or HLS). For more information, see Play a standard live stream.