Activate and configure the services required to build a co-streaming scenario by using the ApsaraVideo Real-time Communication (ARTC) SDK and bypass live streaming.
Activate service
-
Log in to the ApsaraVideo Live console. The activation page appears.
-
Click Activate to go to the ApsaraVideo Live purchase page.
This page compares Standard live streaming and Real-Time Streaming (RTS). Standard live streaming has a latency of ≥3s, supports the RTMP, HLS, and FLV protocols, and is enabled by default after activation. Real-Time Streaming (RTS) has a latency of ≤1s, supports the ARTC (WebRTC) protocol, and requires you to add and configure a streaming domain after you activate ApsaraVideo Live.
-
On the ApsaraVideo Live purchase page, select a billing method: pay-by-data-transfer or pay-by-peak-bandwidth. For more information, see Standard live streaming pricing.
-
Read and agree to the Terms of Service and Service Level Agreement, then click Activate Now to finish the activation.
Step 1: Add ingest and streaming domains
Before you can use ApsaraVideo Live, you need at least one domain name. The ingest domain and streaming domain cannot be the same, but they can be two different subdomains of the same root domain.
For example, if your root domain is test.com, you can configure two subdomains, a.test.com and b.test.com, to use as the ingest and streaming domains, respectively.
-
Prepare your domain names.
-
If you do not have a domain name, you can register one on the Alibaba Cloud Domains platform. For more information, see Register a domain name on Alibaba Cloud.
-
After registering a domain name, you may need to apply for an ICP filing depending on your usage. For more information, see ICP filing procedure.
Note-
To quickly test the basic features of ApsaraVideo Live, you can select a live center outside the Chinese mainland and set the acceleration region to Outside Chinese Mainland. In this case, an ICP filing is not required for your domain name.
-
If the ingest domain and streaming domain are two subdomains of the same root domain, you only need to obtain an ICP filing for the root domain.
-
-
-
Log on to the ApsaraVideo Live console.
In the left navigation pane, click Domain Names. The Domain Management page appears.
-
Click Add Domain.
NoteTo add a subdomain, add a prefix to your registered domain name. A subdomain does not need to be registered separately. Make sure to distinguish between the ingest domain and the streaming domain.
-
Configure the required domain name parameters.
ImportantWhen you add a domain name to ApsaraVideo Live for the first time, you must verify its ownership. For more information, see Verify domain ownership.
-
Record the generated CNAME record value for the next step.
After you add the domain, a configuration table appears. This table includes the streaming domain, record type (CNAME), hostname, and CNAME record value. You must add this CNAME record value at your DNS provider to enable CDN acceleration. You can also click CNAME Configuration Guide to complete the configuration.
Step 2: Configure a CNAME record
To enable acceleration, point your domain to the CNAME address assigned by ApsaraVideo Live. The following example shows how to do this with Alibaba Cloud DNS.
-
Alibaba Cloud CDN validates DNS records by using servers deployed in the Chinese mainland. If you configure regional DNS resolution for your domain, for example, by only configuring the Alibaba Cloud CDN CNAME address for regions outside the Chinese mainland (including Hong Kong, Macao, Taiwan, and other countries and regions), the validation servers cannot resolve the CNAME address. In this case, the CNAME status of the domain in the CDN console is displayed as Pending Configuration. This does not affect the CDN acceleration service.
-
The CNAME domain names for Alibaba Cloud CDN, DCDN, ApsaraVideo Live, and ApsaraVideo VOD can be used only for Alibaba Cloud CDN scheduling and resolution. Alibaba Cloud reserves the right to suspend the corresponding domain names and accounts for any malicious use of CNAME domain names.
-
Log on to Alibaba Cloud DNS.
-
In the left-side navigation pane, choose Authoritative DNS Resolution to go to the domain name resolution page.
-
Find the target domain name and click Settings in the Actions column.
-
Click Add Record and configure the following parameters:
Parameter
Description
Record type
Select CNAME Record to point the domain name to another domain name.
Hostname
Enter the prefix of the domain name. For common prefixes and their corresponding example domain names, see the following table.
Query source
Keep the default value.
Record value
Enter the CNAME value for the record.
TTL
Keep the default value.
Prefix
Example domain
Description
demo
demo.aliyundoc.com
Resolve a subdomain.
@
aliyundoc.com
Resolve a root domain.
*
*.aliyundoc.com
Perform wildcard DNS resolution.
-
Click OK to complete the CNAME configuration.
Verify the CNAME record
-
Method 1: On the Add CNAME Record page, click CNAME Configuration Guide. In the CNAME Verification section, click Verify to check if the CNAME configuration has taken effect.
-
Method 2: Run the nslookup -type=cname yourdomain.com command. If the returned resolution result matches the CNAME value for the domain in the ApsaraVideo Live console, the CNAME configuration has taken effect.
C:\Users\xxx>nslookup -type=cname xxx Server: xxx Address: xxx Non-authoritative answer: xxx canonical name = cxxx.cdngslb.com C:\Users\xxx>
(Optional) Configure an SSL certificate
Due to the security requirements of native browsers, if you need to play live streams in a browser, you must configure an SSL certificate for the ingest and streaming domains. For more information, see Configure secure streaming over HTTPS.
Step 3: Associate the ingest and streaming domains
ApsaraVideo Live uses edge ingest, so you must associate the ingest and streaming domains to enable stream ingest and playback.
-
In the left-side navigation pane, click Domain Names. Find your streaming domain and click Domain Settings in the Actions column to go to the page.
-
Click the Stream Ingest Information tab.
-
Click Add Stream Ingest Information or the edit icon next to Ingest Domain to select the ingest domain that you want to associate. In the Ingest Domain dialog box that appears, select an existing ingest domain from the Ingest Domain drop-down list and click OK. If you need to add a new ingest domain, you must first add it on the Domain Management page.
Step 4: Create an ARTC application
-
Log on to the ApsaraVideo Live console.
-
In the left-side navigation pane, choose .
-
On the Applications page, click Create Application. Select a Billing Method (Pay-by-duration or Pay-by-monthly-95th-percentile-bandwidth).
-
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 your new co-streaming application.
NoteCreating an application is free. You are charged on a pay-as-you-go basis for actual usage. For more information, see Audio and video call pricing.
Step 5: Integrate and develop
To integrate the SDK into your application, see SDK download and integration.
For native client development, see Co-streaming development guide.
URLs for stream relay
Bypass live streaming requires an ingest URL. For information about how to generate ingest URLs, see Generate streaming URLs.
Configure HTTPS and HTTP headers (optional)
For web client playback, browser security policies require you to configure HTTPS secure acceleration and allow cross-origin requests for the streaming domain.
To allow cross-origin requests, configure the Access-Control-Allow-Origin parameter. For more information, see Configure HTTP headers.