Quick start for co-streaming

更新时间:
复制 MD 格式

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

  1. Log in to the ApsaraVideo Live console. The activation page appears.

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

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

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

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

  2. Log on to the ApsaraVideo Live console.

  3. In the left navigation pane, click Domain Names. The Domain Management page appears.

  4. Click Add Domain.

    Note

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

  5. Configure the required domain name parameters.

    Important

    When you add a domain name to ApsaraVideo Live for the first time, you must verify its ownership. For more information, see Verify domain ownership.

    Show parameters

    Parameter

    Value

    Description

    Domain Type

    • Streaming Domain

    • Ingest Domain

    The acceleration type for the domain name. An ingest domain accelerates stream ingest, while a streaming domain accelerates stream delivery. You cannot change this setting after you configure it.

    Note
    • When you add an ingest domain, set Domain Type to Ingest Domain. When you add a streaming domain, set Domain Type to Streaming Domain.

    • You cannot use the same domain name as both an ingest domain and a streaming domain.

    Domain Name

    N/A

    Enter the domain name to accelerate. Note the following:

    • Use a subdomain for the accelerated domain name, such as demo.aliyundoc.com.

    • ApsaraVideo Live does not support wildcard domain names, such as *.aliyundoc.com.

    • An accelerated domain name must be unique. If you receive the message The specified domain already exists, verify that the domain name is not already used in another Alibaba Cloud service, such as ApsaraVideo VOD.

    • After you activate ApsaraVideo Live, you can add up to 20 domain names per account. If the average daily peak bandwidth of your domain names exceeds 50 Mbps and your business is risk-free, you can submit a ticket to request a quota increase. For more information, see Contact Us.

    • All accelerated content must comply with legal requirements and business standards. For details, see Domain name review standards.

    Note

    The subdomain must belong to the same Alibaba Cloud account. ApsaraVideo Live checks this when you add the domain name. If the subdomain belongs to a different account, the system reports an error.

    Acceleration Region

    Chinese Mainland

    • Select Chinese Mainland for the ingest domain if your streamers are located in the Chinese Mainland.

    • Select Chinese Mainland for the streaming domain if your viewers are located in the Chinese Mainland.

    The domain name requires an ICP filing. We recommend that you use the Alibaba Cloud ICP Filing system to apply for an ICP filing.

    Global

    • Select Global for the ingest domain if your streamers are located worldwide, including in the Chinese Mainland.

    • Select Global for the streaming domain if your viewers are located worldwide, including in the Chinese Mainland.

    The domain name requires an ICP filing. We recommend that you use the Alibaba Cloud ICP Filing system to apply for an ICP filing.

    Outside Chinese Mainland

    • Select Outside Chinese Mainland for the ingest domain if your streamers are located outside the Chinese Mainland.

    • Select Outside Chinese Mainland for the streaming domain if your viewers are located outside the Chinese Mainland.

    • If you select Outside Chinese Mainland and the live center is also outside the Chinese Mainland, an ICP filing is not required for your domain name.

    • If you select Outside Chinese Mainland but the live center is in the Chinese Mainland, an ICP filing is required for your domain name. We recommend that you use the Alibaba Cloud ICP Filing system to apply for an ICP filing.

    Note

    For more information about how to select an acceleration region, see How do I select an acceleration region for a domain name?.

    Live Center

    N/A

    A live center provides cloud-based media processing services, such as snapshot capture, recording, transcoding, and production studio.

    The ingest domain and its associated streaming domain must use the same live center region. You cannot change this setting after it is configured.

    For more information about how to select a live center, see How do I select a live center?.

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

Note
  • 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.

  1. Log on to Alibaba Cloud DNS.

  2. In the left-side navigation pane, choose Authoritative DNS Resolution to go to the domain name resolution page.

  3. Find the target domain name and click Settings in the Actions column.

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

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

  1. 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 Streaming Management > Basic Settings page.

  2. Click the Stream Ingest Information tab.

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

  1. Log on to the ApsaraVideo Live console.

  2. In the left-side navigation pane, choose Live + > ApsaraVideo Real-time Communication > Applications.

  3. On the Applications page, click Create Application. Select a Billing Method (Pay-by-duration or Pay-by-monthly-95th-percentile-bandwidth).

  4. Enter a custom Instance Name, select the Terms of Service checkbox, and then click Buy Now.

  5. After a success message appears, refresh the Applications page to view your new co-streaming application.

    Note

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