Co-streaming is a classic scenario for ApsaraVideo Real-time Communication. This topic describes how to activate and configure services to build a co-streaming scenario using the Alibaba Real-Time Communication (ARTC) software development kit (SDK) and bypass live streaming.
Activate ApsaraVideo Live
Log on to the Alibaba Cloud official website and go to the ApsaraVideo Live product page. Click Activate Now.
On the page that appears, click Activate.

On the ApsaraVideo Live buy page, select Live video traffic. For more information, see Billing of standard streaming.
Read and understand Alibaba Cloud International Website Product Terms of Service and ApsaraVideo Live Service Level Agreement, then click Activate Now.

Step 1: Add ingest and streaming domains
To use ApsaraVideo Live, you must add an ingest domain and a streaming domain. The two cannot be the same, but can be different subdomains of a primary one.
For example, you can use a.test.com as the ingest domain and b.test.com as the streaming domain.
Add domain names:
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 2: Add CNAME records to enable acceleration
To accelerate content delivery in ApsaraVideo Live, add the CNAME record at your DNS provider to map your domain name to the CNAME assigned by ApsaraVideo Live. The following example shows how to add a CNAME record when your DNS provider is Alibaba Cloud.
The server that Alibaba Cloud CDN uses to resolve the CNAME is deployed in the Chinese mainland. If you configure region-specific DNS settings for your domain name, for example, you add a CNAME record in regions outside the Chinese mainland, including Hong Kong (China), Macao (China), and Taiwan (China), the domain name cannot be mapped to the CNAME. The status of the CNAME is Pending Configuration in the Alibaba Cloud CDN console. However, CDN acceleration for the domain name is not affected.
CNAMEs assigned by Alibaba Cloud CDN, DCDN, ApsaraVideo Live, and ApsaraVideo VOD can be used only for domain name resolution. If Alibaba Cloud detects that your CNAME is used for unauthorized or malicious activities, Alibaba Cloud reserves the right to close your Alibaba Cloud account and remove the domain names.
Log on to the Alibaba Cloud DNS console.
In the left-side navigation pane, click Authoritative DNS Resolution.
Find the domain name you want to manage and click DNS Settings in the Actions column.

Click Add DNS Record and configure the following information:

Parameter
Description
Record Type
Select CNAME from the drop-down list.
Hostname
Specify a prefix for the domain name. For common prefixes, see the following table.
DNS Request Source
Use the default value.
Record Value
Enter the CNAME that you obtained.
TTL Period
Use the default value.
Prefix
Example
Description
demo
demo.aliyundoc.com
The subdomain name.
@
aliyundoc.com
The root domain name.
*
*.aliyundoc.com
The wildcard domain name.
Click OK.
Check whether a CNAME record takes effect
Method 1: Click CNAME Configuration Guide. In the right-side panel, click Verify in the Verify the CNAME record section.

Method 2: Run the nslookup -type=cname yourdomain.com command. If the returned result is consistent with the CNAME value of the domain name in the ApsaraVideo Live console, the CNAME configuration takes effect.

(Optional) Configure SSL certificates
For security reasons, if you want to play a stream in a native browser, you must configure Secure Sockets Layer (SSL) certificates for the ingest and streaming domains. For more information, see Configure HTTPS secure acceleration.
Step 3: Associate the streaming domain with the ingest domain
ApsaraVideo Live uses the edge ingest method. To ingest and play streams, you must associate the streaming domain with the ingest 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 4. Create an ApsaraVideo Real-time Communication application
Log on to the ApsaraVideo Live console.
In the navigation pane on the left, choose .
On the Applications page, click
.Enter a custom Instance Name, select the Terms of Service checkbox, and then click Buy Now.
After a success message appears, refresh the Applications page to view the created co-streaming application.
NoteCreating an application is free of charge. You are charged on a pay-as-you-go basis for your actual usage. For more information, see Audio and video call pricing.
Step 5. Integration and development
To integrate the SDK, see SDK download and integration.
For native client development, see Co-streaming development guide.
Ingest and streaming URLs for relaying to acceleration nodes
To use bypass streaming to relay streams to acceleration nodes, you must provide an ingest URL. For more information about how to generate the URL, see Generate streaming URLs
Configure HTTPS and HTTP headers for domain names (Optional)
If you have viewers who use web clients for playback, you must configure HTTPS secure acceleration for the streaming domain and allow cross-origin requests. This is because of the security policies of browsers.
To allow cross-origin requests, configure the Access-Control-Allow-Origin parameter. For more information, see Configure HTTP headers.