ApsaraVideo Live provides Real-Time Streaming (RTS), which reduces standard live streaming latency from 3–6 seconds to the millisecond level. It also improves resistance to packet loss. RTS is suitable for scenarios that require low latency and a high level of interaction, such as e-commerce live streaming, online education, live sports, and live shows. This topic describes how to quickly implement RTS.
Prerequisites
You have an ingest domain and a streaming domain for which you have completed the required Internet Content Provider (ICP) filing. For more information, see .
NoteIf your live center is located outside the Chinese mainland and the acceleration region is set to Outside Chinese Mainland, you do not need to apply for an ICP filing for your domain names.
If the ingest domain and the streaming domain are second-level domain names under the same primary domain name, you only need to apply for an ICP filing for the primary domain name.
Basic workflow of RTS
Step 1: Activate ApsaraVideo Live
You can watch a video tutorial to learn how to activate ApsaraVideo Live. For more information, see Activate ApsaraVideo Live.
Log on to the ApsaraVideo Live console.
Click Activate Now to open the activation page. Select Pay-by-traffic as the billing method, and then select the ApsaraVideo Live Terms Of Service checkbox.
Click Activate Now.
Step 2: Add an ingest domain and a streaming domain
Before you use the RTS service, you must add an ingest domain and a streaming domain.
You can watch a video tutorial to learn how to add a domain name. For more information, see Add a domain name.
Prepare domain names.
If you do not have one, register one with Alibaba Cloud Domain Names.
To provide services in the Chinese mainland, you must apply for an Internet Content Provider (ICP) number for your domain name.
NoteTo try the basic features, select a live center in a region outside the Chinese mainland and set the acceleration region to Outside Chinese Mainland. This eliminates the need for ICP filing.
If the ingest and streaming domains are subdomains, ICP filling is required only for the primary one.
Log on to the ApsaraVideo Live console.
In the left-side navigation pane, click Domain Names. The Domain Management page appears.
Click Add Domain.
To add a subdomain, append a prefix to the domain name you have registered. The subdomain does not require separate registration. Ensure you can differentiate between the ingest and streaming subdomains.
In the Add Domain Name step, configure parameters as needed.
ImportantWhen you add a domain name for the first time, ApsaraVideo Live verifies its ownership.

Note down the generated CNAME record for use in the next step.

Step 3: Configure a CNAME record
To enable the ApsaraVideo Live acceleration service, you must point your domain name to the CNAME address that is assigned by ApsaraVideo Live. The following procedure uses Alibaba Cloud DNS as an example.
The servers that Alibaba Cloud CDN uses to verify DNS records for domain names are deployed in the Chinese mainland. If you configure DNS records by region for a domain name, for example, you configure a CNAME for Alibaba Cloud CDN only for regions outside the Chinese mainland (such as Hong Kong (China), Macao (China), and Taiwan (China)), the verification servers cannot resolve the CNAME. In this case, the CNAME status of the domain name is displayed as To Be Configured in the CDN console. This does not affect the CDN acceleration service.
The CNAMEs for Alibaba Cloud CDN, DCDN, ApsaraVideo Live, and ApsaraVideo VOD can only be used for scheduling and resolution by Alibaba Cloud CDN. Alibaba Cloud reserves the right to suspend the domain names and accounts that use CNAMEs maliciously.
In the navigation pane on the left, choose Authoritative DNS Resolution to open the domain name resolution page.
Find the domain name that you want to configure and click Resolution Settings in the Actions column.

Click Add Record and configure the parameters as described in the following table:

Parameter
Description
Record type
Select CNAME to point a domain name to another domain name.
Host record
Enter the prefix of the domain name. Common prefixes and their corresponding example domain names are shown in the table below.
Parsing request source
Select the default value.
Record value
Enter the CNAME value for the record.
TTL
Select the default value.
Prefix
Example domain name
Description
demo
demo.aliyundoc.com
Parses a subdomain.
@
aliyundoc.com
Parses the primary domain name.
*
*.aliyundoc.com
Enables wildcard DNS.
Click Confirm to complete the CNAME configuration.
Verify that the CNAME record is effective
Method 1: On the Add CNAME Record page, click CNAME Configuration Guide. In the CNAME Verification section, click Verify to check whether the CNAME configuration is effective.

Method 2: Run the nslookup -type=cname yourdomain.com command. If the result matches the CNAME value for the domain in the ApsaraVideo Live console, the CNAME configuration is effective.

Configure an SSL Certificate (optional)
If you want to play live streams in a browser, you must configure an SSL certificate for the stream ingest and playback domain names. This is required for browser security. For more information, see Configure HTTPS secure acceleration.
Step 4: Associate an ingest domain and a streaming domain
To use RTS, you must associate an ingest domain with a streaming domain.
You can watch a video tutorial to learn how to associate an ingest domain with a streaming domain. For more information, see Associate an ingest domain with a streaming domain.
In the left-side navigation pane, click Domain Names. On the page that appears, find the streaming domain that you added and click Domain Settings in the Actions column. You are directed to .
Click the Stream Ingest Information tab.
Click Add Stream Ingest Information or the Edit icon next to Ingest Domain and select the ingest domain that you want to associate.
Step 5: Enable the RTS feature
Log on to the ApsaraVideo Live console.
In the navigation pane on the left, choose Live + > RTS.
Select the streaming domain for which you want to enable RTS.
Turn on the RTS switch and select Sub-second (End-to-End Latency: 400-800 ms) or Half-second (End-to-End Latency: 200-400 ms).

Sub-second latency
Features: This option provides an end-to-end latency of 400 ms to 800 ms and high compatibility. It is suitable for low-latency live streaming scenarios that require compatibility with standard live streaming and other ingest and playback protocols.
Supported protocols: It supports stream ingest and playback over the Alibaba Real-Time Communication (ARTC) protocol, which is based on Web Real-Time Communication (WebRTC). This option is forward compatible with standard live streaming and supports the RTMP ingest protocol, origin fetch, and common playback protocols such as RTMP, FLV, and HLS.
Ingest and playback tools: It supports common ingest and playback tools. We recommend that you use the ApsaraVideo Live Push SDK and the ApsaraVideo Player SDK.
Additional information: If the ingested stream contains B-frames or the audio is not encoded in Opus, the backend automatically removes the B-frames and transcodes the audio to Opus for HTML5 playback. This process incurs live stream transcoding fees.
When you use the Alibaba Cloud Web SDK for playback, the underlying native WebRTC does not support B-frames and requires Opus for audio encoding and decoding. To ensure a good playback experience, the system automatically triggers transcoding based on the ingested stream content:
If the ingested stream contains B-frames and AAC-encoded audio, the system automatically triggers video transcoding to remove B-frames and audio transcoding from AAC to Opus. You are charged standard video transcoding fees based on the tier that corresponds to the source resolution.
If the ingested stream does not contain B-frames but contains AAC-encoded audio, the system automatically triggers audio transcoding from AAC to Opus. You are charged for audio-only transcoding.
If you also configure a live stream transcoding template, the system removes B-frames and transcodes to Opus in addition to applying the template. You are charged transcoding fees based on the combined result.
When you use the Alibaba Cloud Native SDK for playback, this SDK natively supports B-frames and AAC. Therefore, automatic transcoding is not triggered and no extra fees are incurred.
Half-second latency
Features: This option provides an end-to-end latency of 200 ms to 400 ms. It is suitable for live streaming scenarios that require extremely low latency.
Supported protocols: It supports stream ingest and playback over the ARTC protocol, which is based on WebRTC. This option is not compatible with standard live streaming and does not support the RTMP ingest protocol, origin fetch, or common playback protocols such as RTMP, FLV, and HLS.
Ingest and playback tools: For stream ingest, you can use the WHIP protocol with OBS or the ApsaraVideo Live Push SDK. For playback, you must use the ApsaraVideo Player SDK.
Other notes: This streaming domain does not support cloud features such as transcoding and recording. However, you can use the Relay Configuration to relay the live stream to another streaming domain.
Click Configure Stream Relay and select an ingest domain that is associated with a streaming domain and that does not have half-second RTS mode or dual-stream disaster recovery enabled. This domain receives the relayed RTMP stream. For example, if the relay receiving domain is
push.example.comand its associated streaming domain ispull.example.com, you can pull the stream frompull.example.comusing standard live streaming protocols to use features such as transcoding and recording after you configure the relay.
The RTS configuration takes several minutes to be deployed across the network. We recommend that you wait a few minutes before testing.
To associate one ingest domain with multiple streaming domains, see Associate primary and secondary streaming domains.
RTS and standard live streaming can share a streaming domain. However, because RTS uses the UDP protocol and standard live streaming uses the TCP protocol, their underlying technologies differ. We recommend that you use a separate streaming domain for RTS.
Step 6: Generate ingest and streaming URLs
Method 1: Generate URLs in the console
After you enable Real-Time Streaming (RTS), navigate to the stream ingest and playback experience tool and click Generate URLs. Then, enter an AppName and a StreamName to generate ARTC protocol RTS ingest and streaming URLs.

Method 2: Manually construct URLs
When you manually construct ingest and streaming URLs, you must determine whether the live stream is transcoded and whether URL signing is enabled. You also need the ingest domain, streaming domain, AppName, StreamName, transcoding template ID (if applicable), and access token (if applicable). The following table describes the URL construction rules.
Address Class | Address format | Construction rule |
Ingest URL | RTMP, RTS, and SRT protocols are supported. Use an RTMP URL for stream ingest. For example: RTMP: Note RTS supports stream pulling with addresses in the RTS format. | Ingest domain + AppName + StreamName + Access token |
Streaming URL | RTMP, FLV, M3U8, and RTS protocols are supported. Use an RTS URL for playback. For example: RTS: | Streaming domain + AppName + StreamName + Access token |
Transcoded stream URL Note A transcoded stream URL is generated only if you configure a transcoding template. If you use a transcoded stream, you must construct the streaming URL using the transcoded stream URL format. | RTMP, FLV, M3U8, and RTS protocols are supported. Use an RTS URL for playback. For example: RTS: | Streaming domain + AppName + StreamName_Transcoding template ID + Access token |
For associated ingest and streaming domains, you can start stream ingest and playback if the AppName and StreamName are the same for both.
A transcoded stream URL is generated only after you set a transcoding template. You can view the transcoding template ID in the console. For more information, see Live stream transcoding.
The access token (auth_key) is an encrypted string that is generated by a signing algorithm. This requires the URL signing feature to be enabled. You can use the MD5 algorithm to calculate the access token. For more information, see Components of a signed URL.
When you manually construct a URL, replace {transcoding_template_ID} or {access_token} with the actual data. Do not include the curly braces {}.
Step 7: Start stream ingest and playback for RTS
After you enable RTS and generate ingest and streaming URLs, you can use the Try RTS tool to quickly test stream ingest and playback. You can choose to ingest a stream from your camera or by sharing your screen.
The stream ingest and playback experience tool in the console uses a proxy signaling domain name for a quick trial. If you integrate the web ingest and playback SDK, you must also configure an SSL certificate and the correct Access-Control-Allow-Origin response header for the ingest and streaming domains.

In addition to this quick trial method, Alibaba Cloud RTS provides mobile and web demos that you can try.
The following SDKs are also available for integration:
SDK type | References |
Mobile | |
Web |
If playback issues occur, you can use the self-service troubleshooting tool to diagnose them. This tool can quickly diagnose common live playback issues and provide solutions. For more information, see Self-service troubleshooting.
Configure an SSL certificate (Optional)
To meet browser security requirements and enable Real-Time Streaming (RTS) playback, you must configure an SSL certificate for your stream ingest and playback domain names. For more information, see Configure HTTPS secure acceleration.
If you use the RTS stream ingest and playback SDKs or demos, you do not need to configure an SSL certificate.
Configure custom URL signing (Optional)
The URL signing feature protects your site's content from unauthorized downloads. This feature is enabled by default when you add a domain name.
After you enable URL signing, you can use the default signing method or a custom one. The default method requires no configuration. If you do not want to use the default configuration, you can customize the Primary Key, Secondary Key, and Validity Period, and enter the original URL.
You can watch a video tutorial to learn how to configure URL signing. For more information, see Configure URL signing.
In the navigation pane on the left, choose Domain Names, select a streaming domain for which the RTS feature is enabled, and click Domain Settings in the Actions column.
Choose to open the Access Control page.
Click the URL Signing tab, and then click Modify.
NoteIf URL signing is enabled, click Modify to configure URL signing information. If you previously disabled URL signing, turn on the URL Signing switch to configure the information.
Configure URL signing information. The following table describes the configuration items.
Configuration item
Description
Authentication Type
ApsaraVideo Live streaming domains support only signing method A to effectively protect origin resources.
Note
If a URL signing error occurs, a 403 error is returned. Recalculate the signature.
MD5 calculation error
For example:
X-Tengine-Error:denied by req auth: invalid md5hash=de7bfdc915ced05e17380a149bd760beTimestamp error
For example:
X-Tengine-Error:denied by req auth: expired timestamp=1439469547
Primary Key
When you add a domain name, the console randomly generates a primary key. In the left navigation bar of the ApsaraVideo Live console, select Domains, select the domain name that you want to configure, and click to view the primary key on the URL Signing page. You can also change the primary key for the authentication method.
Secondary Key
Enter a custom secondary key for the signing method.
Validity Period
A signed URL can be used to start stream ingest or playback only within its validity period. Live stream ingest and playback are long-link behaviors. An active stream ingest or playback session is not interrupted if the validity period expires. However, new requests for stream ingest or playback fail after the validity period expires.
When you add a new domain name for the first time, the default validity period is 1 day (1440 minutes). Set a custom default validity period, in minutes, for the URL signing method. The period must be at least 1 minute and has no upper limit.
Other operations: How to verify RTS latency
You can add a time calibrator URL to your stream ingest and compare the time displayed on the stream with a standard time source to verify the latency of RTS. This procedure uses OBS Studio as an example.
On the OBS main interface, in the Sources section, add a browser source and enter the time calibrator URL. Then, click Start Streaming.