This topic describes how to use ApsaraVideo Live to stream live.

Prerequisites

  • An Alibaba Cloud account is created and real-name verification is complete. To create an Alibaba Cloud account, visit the Alibaba Cloud official website. For more information about how to create an Alibaba Cloud account, see Create an Alibaba Cloud account.

  • An ingest domain and a streaming domain are available. ICP filing for the domain names is complete. For more information, see ICP filing documentation.
    Note
    • If you are in a live center outside the Chinese mainland and set Edge Group to Outside Mainland China for the domain names, ICP filing is not required.
    • If the ingest domain and the streaming domain are second-level domain names under the same top-level domain name, you need to apply for an ICP number only for the top-level domain name.

Basic procedure

  1. Activate ApsaraVideo Live
  2. Add an ingest domain and a streaming domain
  3. Add CNAME records
  4. Bind the ingest domain to the streaming domain
  5. (Optional) Configure custom URL authentication
  6. Generate ingest and streaming URLs
  7. Live stream ingest
  8. Live stream playback

Activate ApsaraVideo Live

  1. Log on to the Alibaba Cloud official website. In the top navigation bar, choose Products > Media Services > ApsaraVideo Live. On the ApsaraVideo Live homepage,
  2. click Activate Now.
  3. On the ApsaraVideo Live activation page, select Pay-By-Traffic as the billing method. Read and agree to the service agreement.
  4. Click Activate Now.

Add an ingest domain and a streaming domain

To use ApsaraVideo Live services, you must add an ingest domain and a streaming domain.

  1. Log on to the ApsaraVideo Live console.
  2. In the left-side navigation pane, click Domains. The Domain Management page appears.
  3. Click Add Domain.
  4. Configure the domain name based on your business requirements.
    Configure the domain name
    Parameter Option Description
    Domain Name N/A
    Enter the domain name that you want to accelerate. Take note of the following points:
    • In most cases, use a subdomain name as an accelerated domain name. Example: demo.aliyundoc.com.
    • ApsaraVideo Live does not support wildcard domain names, such as *.aliyundoc.com.
    • Duplicate accelerated domain names are not allowed. If the error message The specified domain already exists is displayed, check whether the domain name is added to other cloud services such as ApsaraVideo VOD, Dynamic Route for CDN (DCDN), Secure CDN (SCDN), or Video Surveillance System.
    • After you activate ApsaraVideo Live, you can add a maximum of 20 domain names to ApsaraVideo Live for each Alibaba Cloud account. If the average daily peak bandwidth of your domain names exceeds 50 Mbit/s, you can submit a ticket to increase your quota of domain names. Make sure that the quota increase does not incur business risks.
    • Content that is served from the domain name must comply with the limits of ApsaraVideo Live. For more information, see Verify a domain name.
    Note The specified subdomain name must belong to the same Alibaba Cloud account. When you add a subdomain name, ApsaraVideo Live verifies the ownership of the subdomain name. If the subdomain name belongs to a different account, an error message appears.
    Live Center N/A

    A live center provides media processing services for live streams in the cloud, such as snapshot capture, recording, transcoding, and production studio.

    The live center of an ingest domain must be located in the same region as that of the bound streaming domain. This parameter cannot be modified once set.

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

    Domain Type
    • Streaming Domain
    • Ingest Domain
    The type of the domain name. You can add an ingest domain or a streaming domain. This parameter cannot be modified once set.
    Note
    • To add an ingest domain, select Ingest Domain for Domain Type. To add a streaming domain, select Streaming Domain for Domain Type.
    • You cannot add a domain name as both an ingest domain and a streaming domain.
    Edge Group Chinese Mainland The edge group in which content delivery is to be accelerated. Valid values:
    • Chinese Mainland

      For an ingest domain, if the streamers are located in the Chinese mainland, select Chinese Mainland.

      For a streaming domain, if the audience is located in the Chinese mainland, select Chinese Mainland.

      Apply for ICP filing from the Ministry of Industry and Information Technology of China for the domain name. We recommend that you use the Alibaba Cloud ICP Filing system.

    • Global

      For an ingest domain, if the streamers are located in the Chinese mainland, Hong Kong (China), Macau (China), Taiwan (China), and other countries and regions, select Global.

      For a streaming domain, if the audience is located in the Chinese mainland, Hong Kong (China), Macau (China), Taiwan (China), and other countries and regions, select Global.

      Apply for ICP filing from the Ministry of Industry and Information Technology of China for the domain name. We recommend that you use the Alibaba Cloud ICP Filing system.
    • Outside Chinese Mainland

      For an ingest domain, if the streamers are located in countries and regions outside the Chinese mainland, including Hong Kong (China), Macau (China), and Taiwan (China), select Outside Chinese Mainland.

      For a streaming domain, if the audience is located in countries and regions outside the Chinese mainland, including Hong Kong (China), Macau (China), and Taiwan (China), select Outside Chinese Mainland.

      If you select Outside Chinese Mainland and the live center is located outside the Chinese mainland, you do not need to apply for ICP filing for the domain name.

      If you select Outside Chinese Mainland and the live center is located in the Chinese mainland, you must apply for ICP filing for the domain name. We recommend that you apply for ICP filing by using the Alibaba Cloud ICP Filing system.

    Note

    For more information about how to select an edge group, see How do I select an edge group for domain names?.

    Global
    Outside Chinese Mainland
  5. Click Submit.

Add CNAME records

To enable acceleration for ApsaraVideo Live, you must add CNAME records at your DNS service provider to map your ingest domain and streaming domain to the canonical domain name that is assigned by ApsaraVideo Live. The following example shows how to add a CNAME record when your DNS service provider is Alibaba Cloud. For information about how to add a CNAME record at other DNS service providers, see Configure a CNAME record.

Note
  • The server that Alibaba Cloud CDN uses to resolve the CNAME of a domain name is deployed in the Chinese mainland. If you configure region-specific DNS settings for your domain names, for example, you add a CNAME record for your domain name in regions outside the Chinese mainland, including Hong Kong (China), Macao (China), 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 that are assigned by Alibaba Cloud CDN, Dynamic Route for CDN (DCDN), ApsaraVideo Live, and ApsaraVideo VOD are used only for domain name resolution. If you use the CNAMEs to engage in malicious activities, Alibaba Cloud reserves the right to close your Alibaba Cloud account and remove the domain names.
  1. Log on to the Alibaba Cloud DNS console.
  2. In the left-side navigation pane, click Domain Name Resolution. The Domain Name Resolution page appears.
  3. Find the domain name for which you want to configure a CNAME record and click DNS Settings in the Actions column.
  4. Click Add DNS Record. In the Add DNS Record panel, set the parameters that are described in the following table.001
    Parameter Description
    Record Type Select CNAME- Canonical name from the drop-down list.
    Hostname Specify a prefix for the domain name. For more information about regular prefixes of domain names and sample domain names, see the following table.
    DNS Line Use the default value.
    Record Value Enter the CNAME that you obtained.
    TTL Period Use the default value.
    Prefix Sample domain name Description
    demo demo.aliyundoc.com The subdomain name is resolved.
    @ aliyundoc.com The main domain name is resolved.
    * *.aliyundoc.com A wildcard DNS record is configured.
  5. Click Confirm.

To check whether a CNAME record is in effect, run the ping <domain name> or dig <domain name> command. If a message which indicates that the domain name is resolved to *.*kunlun*.com is displayed, the CNAME record is in effect.

Bind the ingest domain to the streaming domain

ApsaraVideo Live uses the edge ingest method. To ingest and play streams, you must bind the ingest domain to the streaming domain.

  1. On the Domain Management page, find the streaming domain that you added and click Domain Settings in the Actions column. The Streaming Management > Basic Settings page appears.
  2. Click the Basic Information tab.
    On this tab, you can view the CNAME, Added At, Domain Type, Live Center, Edge Group, and Quota Limits information. Basic information
    Note
    • You can manage quotas of ApsaraVideo Live only in the China (Beijing), China (Shanghai), China (Shenzhen), and Singapore (Singapore) regions. To increase quotas for other centers, submit a ticket.
    • For more information about quota limits, see Quota management.
    • For more information about how to change the edge group, see Change the edge group.
  3. Click the Stream Ingest Information tab to view recordings stored in OSS buckets.
  4. Click Add Stream Ingest Information or the Edit icon next to Ingest Domain and select the ingest domain that you want to bind.

(Optional) Configure custom URL authentication

You can use the URL authentication feature to protect resources on origin servers from unauthorized access and downloads. We recommend that you keep this feature enabled to prevent your content from being pirated.

You can use the default URL authentication method or a custom URL authentication method based on your business requirements. If you select the default URL authentication method, no additional configuration is required. If you do not want to use the default configurations, you can set the Primary Key, Secondary Key, Validity Period, and Original URL parameters as needed.

  1. On the Domains page, find the streaming domain that you added and click Domain Settings in the Actions column.
  2. Choose Streaming Management > Access Control. The Access Control page appears.
  3. Click the URL Authentication tab and turn on URL Authentication.
  4. Configure the URL authentication information.
    The following table describes the parameters.
    Parameter Description
    Authentication Type
    ApsaraVideo Live streaming domains support only the authentication type of Type A to protect resources on the origin server.
    Note If URL signing fails, an HTTP status code 403 is returned. In this case, you must recalculate the signature.
    • Invalid MD5 values

      Example: X-Tengine-Error:denied by req auth: invalid md5hash=de7bfdc915ced05e17380a149bd760be

    • Invalid timestamps

      Example: X-Tengine-Error:denied by req auth: expired timestamp=1439469547

    Primary Key After you add a domain name, ApsaraVideo Live generates a random primary key for the domain name. To view the primary key, click Domains in the left-side navigation pane and click the domain name. On the page that appears, choose Streaming Management > Access Control. Then, view the primary key on the URL Signing tab. You can also change the primary key.
    Secondary Key Specify a custom secondary key.
    Validity Period The signed URL can be used to initiate stream ingest or streaming requests only within the validity period. Persistent connections are established for stream ingest and streaming. Stream ingest and streaming requests that are initiated within the validity period are not dropped after the validity period expires. New stream ingest and streaming requests fail to be initiated after the validity period expires.

    The default validity period for a signed URL under a domain name that you add is 1 day or 1,440 minutes. You can specify a custom validity period for the signed URL.

Generate ingest and streaming URLs

Ingest and streaming URLs are used to ingest and play streams. Perform the following steps to generate ingest and streaming URLs.

  1. Log on to the ApsaraVideo Live console.
  2. In the left-side navigation pane, choose URL Generators > Live URL Generator.
  3. Configure the parameters described in the following table.
    URL generator
    Parameter Description
    Streaming Domain Select a streaming domain from the Streaming Domain drop-down list.
    Authentication Type By default, Type A is used and the validity period is 30 minutes.
    Note For more information about how to change the validity period, see Configure URL signing.
    Ingest Domain
    • If an associated ingest domain exists, the ingest domain is automatically selected. If no associated ingest domain exists, you need to bind an ingest domain to the specified streaming domain.
    • If you need only to pull streams, leave this parameter empty.
    Application Name Enter the name of the application in the Application Name field.
    Note The name can be up to 256 characters in length and can contain digits, letters, hyphens (-), underscores (_), and equal signs (=).
    Stream Name Enter the name of the stream in the Stream Name field.
    Note The name can be up to 256 characters in length and can contain digits, letters, hyphens (-), underscores (_), and equal signs (=).
    Transcoding Template Select the Transcoding Template that you have configured. If you do not specify this parameter, the default value Original Quality is used.
    Generate URLs Click Generate URLs to generate ingest and streaming URLs.
    Note
    • ApsaraVideo Live determines whether a stream is unique based on the stream name instead of the application name. If you specify a unique application name, you must also specify a unique stream name to ensure that the stream is unique. If you want applications with different application names under a domain name to ingest the same stream, you must enable the application isolation feature. To enable this feature, submit a ticket.
    • If an ingest domain is bound to the specified streaming domain, ingest URLs are generated.
    • If you do not select a transcoding template, streaming URLs for the original quality stream are generated. If you select a transcoding template, streaming URLs for the transcoded stream are generated.

Live stream ingest

Live stream ingest is the process of delivering the collected audio and video live streams to a live center of ApsaraVideo Live. The following procedure provides an example on how to ingest a stream by using OBS Studio. For information about how to use other stream ingest tools to ingest a stream, see Live stream ingest.

  1. Download and install OBS Studio. Download link: OBS Studio.
  2. Run OBS Studio.
  3. In the menu bar, choose File > Settings.
  4. On the Settings page, click Stream and configure the following parameters.
    001
    Parameter Description
    Service Select Custom....
    Server Enter the generated ingest URL that is authenticated. Example: rtmp://demo.aliyundoc.com/app/stream?auth_key=1543302081-0-0-9c6e7c8190c10bdfb3c0************.
    Stream Key Leave this parameter empty.
  5. Go to the homepage of OBS Studio. Find the Sources section, add a source, and then click Start Streaming.
    002
Note If you encounter issues such as stream ingest exceptions during stream ingest, you can use the troubleshooting tool to troubleshoot the issues. The tool allows you to diagnose common stream ingest issues and provides suggestions for you to resolve specific exceptions. For more information, see Troubleshooting.

Live stream playback

Live stream playback is the process of delivering a live stream from a live center of ApsaraVideo Live to a player for playback. The following procedure provides an example on how to play a stream by using VLC media player. For information about how to use other players to play a stream, see Live stream playback.

  1. Download and install VLC media player. Download link: VLC media player.
  2. Run VLC media player.
  3. In the menu bar, choose Media > Open Network Stream....
  4. On the Network tab, enter a network URL, that is, a streaming URL. Example: rtmp://example.aliyundoc.com/app/stream?auth_key=1543300311-0-0-d47ce016332bf280cf275********.
  5. Click Play.
Note If you encounter issues such as playback exceptions during streaming, you can use the troubleshooting tool to troubleshoot the issues. The tool allows you to diagnose common stream playback issues and provides suggestions for you to resolve specific exceptions. For more information, see Troubleshooting.

Other features

ApsaraVideo Live provides various features, such as permission management, basic services, streaming acceleration, streaming security, streaming latency control, HTTP configuration, media processing for live streams, streaming management, statistics, and log management. For more information about how to use the preceding features, see Overview.