This topic shows you how to add and configure domain names for CDN, obtain a streaming URL, and ingest and play streams.

Prerequisites

  1. An Alibaba Cloud account is created. For more information, see Sign up with Alibaba Cloud.
  2. Two licensed domains are available. For more information about how to apply for an ICP license, see ICP Filing.
    Note
    • If you select a live center and use CDN nodes for domain names that are hosted outside mainland China, you do not need to apply for an ICP license.
    • If the ingest domain and streaming domain that you want to add are second-level domains under the same top-level domain, you need to apply for an ICP license only for the top-level domain.

Background information

If you are using ApsaraVideo Live for the first time, you can start with Limits.

Activate ApsaraVideo Live

  1. Log on to the Alibaba Cloud International site by using your Alibaba Cloud account. In the top navigation bar, choose Products > Media Services > ApsaraVideo Live to go to the ApsaraVideo Live product page.
  2. On the ApsaraVideo Live product page, click Buy Now.
  3. On the ApsaraVideo Live activation page, select Pay-By-Traffic as the billing method. Read and accept the service agreement, and click Activate Now. Then, you can go to the ApsaraVideo Live console.

Add an ingest domain and streaming domain

To use ApsaraVideo Live to ingest and play streams, you must add an ingest domain and streaming domain.

  1. Log on to the ApsaraVideo Live console.
  2. In the left-side navigation pane, click Domains to go to the Domain Management page.
  3. Set the Domain Name, Live Center, Domain Type, and Edge Group parameters.
    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 rules:
    • You can use a subdomain name as the domain name for CDN, such as demo.aliyundoc.com.
    • ApsaraVideo Live does not support wildcard domain names, such as *.aliyundoc.com.
    • You cannot add duplicate domain names to ApsaraVideo Live. 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. You can also submit a ticket.
    • 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 the 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 names must belong to the same Alibaba Cloud account. When you add a domain name, ApsaraVideo Live verifies the ownership of the domain name. If the specified subdomain names belong to different accounts, an error message appears. To request technical support from Alibaba Cloud, submit a ticket.
    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.

    Domain Type
    • Streaming Domain
    • Ingest Domain
    The type of the domain name. You can add a domain name as an ingest domain or a streaming domain. This parameter cannot be modified once set.
    Note
    • To add an ingest domain, set the Domain Type parameter to Ingest Domain. To add a streaming domain, set the Domain Type parameter to Streaming Domain.
    • The ingest domain and streaming domain must be different.
    Edge Group Mainland China If you select Mainland China, you must apply for an ICP filing for the domain name. For more information, see Limits.
    Global If you select Global, you must apply for an ICP filing for the domain name. For more information, see Limits.
    Outside Mainland China If you select Outside Mainland China and the live center is located in a region outside China, you do not need to obtain an ICP filing.

Configure a CNAME record

You must configure a CNAME record to map your domain name for CDN to the CNAME that is allocated by ApsaraVideo Live. This way, the requests that are sent to the domain name can be redirected to the CDN nodes provided by ApsaraVideo Live for accelerated content delivery. The following example shows you how to add a CNAME record for a domain name in the Alibaba Cloud DNS console.

Note
  1. On the Domain Management page, find the streaming domain that you added in the previous step and copy the CNAME of the domain name.
    Note If an exclamation point (!) exists in the CNAME column, no CNAME record is configured for the domain name that you specified. You can perform the following steps to configure a CNAME record.
  2. Add a CNAME record for the domain name.
    If your DNS service is provided by other DNS service providers, such as DNSPod, Xinnet, or GoDaddy, add a CNAME record for your domain name in the system of your service provider. The procedure is similar to the procedure that is described in this topic.
    1. Log on to the Alibaba Cloud DNS console.
    2. On the Manage DNS page, find the domain name that you want to manage and click Configure in the Actions column.
    3. Click Add Record and add a CNAME record.
      • Type: Select CNAME- Canonical name from the drop-down list.
      • Host: Enter the prefix of the domain name for CDN.
        Domain name for CDN Host
        example.aliyundoc.com example
        www.example.com www
        aliyundoc.com @
        *.aliyundoc.com *
      • ISP Line: Use the default value.
      • Value: Enter the CNAME that you copied in the previous step.
      • TTL: Use the default value.
    4. Click Confirm.
  3. After you add a CNAME record for the streaming domain, you must perform the same steps to add a CNAME record for the ingest domain.
    Note The CNAME records take effect soon after they are added.
    • A new CNAME record takes effect immediately. A modified CNAME record takes effect within 72 hours.
    • If you encounter record conflict issues when you add a CNAME record, change the domain name or solve the problem by referring to Evaluate record conflicts.
    • It takes about 10 minutes until the status of the CNAME is updated. Therefore, even if you have configured a CNAME record, the No CNAME record is added message may be displayed on the Domain Management page in the ApsaraVideo Live console. In this case, ignore the message.
  4. Check whether the CNAME record takes effect.
    The time required for a CNAME record to take effect varies with the DNS service provider. You can run the ping or dig command followed by a domain name for CDN to check whether the new CNAME record takes effect. If your request to the domain name for CDN is redirected to *.*kunlun*.com, both the CNAME record and the CDN service take effect. Verify the CNAME record

Bind an ingest domain to a streaming domain

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

  1. On the Domain Management page, find the streaming domain that you added and click Domain Settings.
  2. Choose Stream Management > Basic Settings and click the Basic Information tab.
    On this tab, you can view the CNAME record, time when the domain name was added, domain type, live center, and edge group of the domain.
  3. Click the Stream Ingest Information tab.
  4. Click the Edit icon next to Add Stream Ingest Information or Ingest Domain, select the ingest domain that you want to bind to, and then click OK.

(Optional) Configure custom URL authentication

The URL authentication feature can be used to protect the resources on origin servers from unauthorized access and downloads. By default, URL authentication is enabled. 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 configuration, you can customize Primary Key, Secondary Key, and Validity Period and enter the original URL.

  1. In the left-side navigation pane of the ApsaraVideo Live console, click Domains. The Domain Management page appears.
  2. Find the streaming domain that you want to configure and click Domain Settings.
  3. Choose Stream Management > Access Control, click the URL Authentication tab, and then click Change Settings.
  4. Modify the URL authentication configurations and click OK. Configure URL authentication

Generate ingest and streaming URLs

The ingest URL and streaming URL are required. They are used to ingest and play streams. Perform the following steps to generate ingest and streaming URLs.

  1. Choose Tools > URL Generator.
  2. Select a streaming domain and its associated ingest domain.
  3. Set the Application Name and Stream Name parameters.
  4. Set the Transcoding Template parameter as required.
  5. Click Generate URLs. The ingest URL and streaming URLs are generated.
    001

Ingest and play streams

Stream ingest refers to the process of pushing the collected audio and video live streams to the live center of ApsaraVideo Live. Streaming refers to the process of delivering live streams from the live center of ApsaraVideo Live to players for playback. The following content uses the demo of RTS SDK for Open Broadcaster Software (OBS, a third-party tool) on PCs provided by ApsaraVideo Live, VLC (a third-party player) on PCs, Alibaba Cloud Live (a demo application of ApsaraVideo Live), and ApsaraVideo Player SDK for web as examples to show you how to ingest and play streams.

Notice
  • The information about third-party products (OBS and VLC) in this topic is only for reference. Alibaba Cloud does not make a guarantee, explicitly or implicitly, with respect to the performance and reliability of the third-party products, and potential impacts of operations on the products.
  • Alibaba Cloud Live is a demo application which can be used to ingest and play streams.
  • Flash player is not supported by mainstream browsers, so you cannot preview streams whose streaming URLs adopt the Real Time Messaging Protocol (RTMP) in ApsaraVideo Player SDK for web. ApsaraVideo Player SDK for web supports only the HTTP-FLV, HTTP Live Streaming (HLS), and Alibaba Real-Time Communication (ARTC). If you use ApsaraVideo Player SDK for web to play streams, you must first perform the cross-domain configurations for streaming domains. For more information about the configurations, see the operation guide in the following step.
  1. Download and install a stream ingest tool and media player.

    Download a suitable tool based on your business requirements.

    Stream ingest tool Download link

    Stream ingest on PCs

    The demo of RTS SDK for OBS on PCs is used as an example.

    Stream ingest on mobile devices

    Alibaba Cloud Live is used as an example.

    Scan the following QR code to install the demo application Alibaba Cloud Live. Installation package of the demo
    Media player Download link

    Streaming on PCs

    The third-party player VLC is used as an example.

    To download VLC player, visit VLC media player.

    Streaming on mobile devices

    Alibaba Cloud Live is used as an example.

    Scan the preceding QR code to install the demo application Alibaba Cloud Live.If Alibaba Cloud Live is installed, skip this step.
  2. Push streams by using a stream ingest tool.

    Follow the operation guide in the following table to ingest streams based on the stream ingest tool that you use.

    Device Operation guide

    PC

    The demo of RTS SDK for OBS on PCs is used as an example.

    1. Run the demo of RTS SDK for OBS.
      Note If you open the demo of RTS SDK for OBS on a macOS device for the first time, you may receive the following error message:

      macOS cannot verify whether this application contains malware.

      You can open this application by modifying the security and privacy settings on the macOS.

    2. Click Settings.
    3. On the Settings page, click Stream to go to the streaming page. Then, configure Server. Enter the generated authenticated ingest URL in the Server field. For example, enter the following ingest URL: rtmp:/demo.aliyundoc.com/app/stream?auth_key=1543302081-0-0-9c6e7c8190c10bdfb3c0************.obs
      Note
      • In this example, the ingest URL consists of an ingest domain, an application name, a stream name, and an access token. Replace them with the actual values of your ingest URL.
      • Enter the full name of the ingest URL to the Server field and keep the Stream key field blank.
      • For more information about how to configure and use the demo of RTS SDK for OBS, see OBS.
    4. In the Sources section, add a video source and click Start Streaming.

    Mobile device

    Alibaba Cloud Live is used as an example.

    1. Open Alibaba Cloud Live on the mobile device and select Stream Ingest by Camera or Stream Ingest by Screen Recording to go to the Start Stream Ingest page.
      Note
      • Only the yuv formatted files are allowed for ingesting streams from mobile devices.
      • Stream Ingest by Camera uses the camera of the mobile phone to ingest streams. Stream Ingest by Screen Recording records the screen of the mobile phone to ingest streams.
    2. At the top of the Start Stream Ingest page, enter the generated ingest URL that contains the authentication information, such as rtmp://demo.aliyundoc.com/app/stream?auth_key=1543302081-0-0-9c6e7c8190c10bdfb3c0************.
    3. Configure the stream ingest settings, such as resolution, and click Start Stream Ingest at the bottom.
    After a stream is ingested, you can go to the ApsaraVideo Live console and click Stream Management to view the list of active ingest endpoints. If the video information is displayed in the list, the stream is ingested.
  3. Play streams by using a media player.

    Follow the operation guide in the following table to play streams based on the media player that you use.

    Device Operation guide

    PC

    The third-party player VLC is used as an example.

    1. Open the VLC player and choose Media > Open Network Streaming.
    2. In the Enter Network URL dialog box, enter the streaming URL, such as rtmp://example.aliyundoc.com/app/stream?auth_key=1543300311-0-0-d47ce016332bf280cf275********), and click Play.
    Note In this example, the streaming URL consists of a streaming domain, an application name, a stream name, and an access token. Replace them with the actual values of your streaming URL.

    For information about cross-origin errors during streaming, see What can I do if a message indicating a cross-origin error appears when the player plays streams based on M3U8 playlists?

    Mobile device

    Alibaba Cloud Live is used as an example.

    1. Open Alibaba Cloud Live on the mobile device and tap Play by Live to go to the Pull Stream page.
    2. On the Pull Stream page, enter the generated streaming URL. For example, the streaming URL is rtmp://example.aliyundoc.com/app/stream?auth_key=1543300311-0-0-d47ce016332bf280cf275********.
    3. Click Pull Stream.

    Web

    The ApsaraVideo Player SDK for web is used as an example.

    1. Configure cross-origin resource sharing (CORS) for the streaming domain that you created. The configuration item is the Access-Control-Allow-Origin in the HTTP header. For more information, see Configure HTTP headers.
      Note Select the streaming domain that you created to go to the configuration page. You can enter * in the Access-Control-Allow-Origin field to specify all domain names. You can also enter the domain name of ApsaraVideo Player SDK for web. For example, http://example.aliyundoc.com.
    2. Click Basic, and select Broadcast for Video Type, Enter or copy the generated streaming URL to the ApsaraVideo Player SDK for web.
    3. Click Preview.
    Notice
    • Flash player is not supported by mainstream browsers, so you cannot preview streams whose streaming URLs adopt RTMP in ApsaraVideo Player SDK for web.

Other features

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