Alibaba Cloud’s ApsaraVideo Live service provides stream ingestion and live streaming service which are triggered. You are not required to create resource, but create an ingest domain and a streaming domain that have completed ICP filing, CNAME configuration and authorization. And you can quickly get the corresponding ingest URL and streaming URL based on URL splicing rules. This article introduces the splicing method of the ingest URL and the streaming URL of the live activities which perform encoding.

Note
  • This article introduces how to get the spliced URLs manually. You can also get the ingest URL and the streaming URL in the console. For more information, see Configure edge ingestion.
  • If you want to create multiple live activities , you can also splice the ingest URL and the streaming URL in bulk. For more information, see Create multiple live activities.
  • If you don't configure encoding service for your live activities, for more information about the splicing rules of ingest URL and streaming URL, see Ingest URL and streaming URL (Original).
  • In this article, the ingest URL and the streaming URL in the example are for your reference only. You can follow the splicing rules to get your own ingest URL and streaming URL by using your ingest domain, streaming domain, Application Name, Stream Name and the authentication string obtained by authentication.

Prerequisites

Perform the following operations to get the authorized ingest URL and streaming URL:
  • Add a domain name

    You must first created an ingest domain and a streaming domain that have completed ICP filing. For more information, see Add a domain name.

  • Configure CNAME

    After adding a domain, you must configure the CNAME for it to take effect. For more information about how to configure CNAME, see Configure CNAME.

  • Associate domain names

    After adding domain names, you must associate the ingest domain and the streaming domain before you perform stream ingestion and live streaming operations. For more information, see Associate domain names.

  • Configuration authentication
    The authorization function is enabled by default. We recommend that you keep it enabled; otherwise, a risk of bootlegging may occur. If you want to disable authentication function, contact your business manager or open a ticket You can use the default authentication configuration, or you can customize authentication. For more information, see Configure authentication.
    Note If you want to disable the authentication function due to special scenarios, open a ticket. For more information about how to get unauthorized ingest URL and streaming URL, see Ingest URL and streaming URL (Original) and Ingest URL and streaming URL (Encoding).

How do I get encoding ingest URL?

  • Generation rules of ingest URL

    ApsaraVideo Live service supports ingest URL in RTMP format only.

    The ingest URL format is RTMP://ingest domain name/AppName/StreamName? authentication string

  • Examples

    Example: the ingest domain is push.aliyunlive.com, the Application Name is app, the Stream Name is stream, and the authentication key is 123, then the ingest URL is RTMP://push.aliyunlive.com/app/stream? auth_key=timestamp-rand-uid-md5hash

How do I get encoding streaming URL?

You must first configure encoding. ApsaraVideo Live supports default encoding and custom encoding. After you configure encoding and obtain the ID, you can generate the encoding streaming URL based on the generation rules.

  1. Configure encoding templates.
    • Configure default encoding
      1. Log on to the ApsaraVideo Live console.
      2. Click Domains.
      3. Select the Streaming Domain, and click Stream Settings.
      4. In Encoding Settings, select Default, and click Add.

      5. Enter encoding settings parameters. You can select the corresponding ID based on your settings.
        Narrowband HD™

        Note For more information about default encoding, see Default encoding.
    • Configure custom encoding
      1. Log on to the ApsaraVideo Live console.
      2. Click Domains.
      3. Select the Streaming Domain, and click Stream Settings .
      4. In Encoding Settings, select Custom, and click Add.

      5. Enter encoding setting parameters. You can select the corresponding ID based on your configuration.
        Narrowband HD™Template

        Note For more information about custom encoding, see Custom encoding.
  2. Get ID.
    • Get the ID in the ApsaraVideo Live console.

      You can obtain the corresponding template ID by following the previous steps.

    • Get the ID by using API.

      You can call the DescribeLiveStreamTranscodeInfo interface, and the system returns the template ID. For more information, see DescribeLiveStreamTranscodeInfo.

      In addition, users can customize encoding settings based on added fields. For more information about getting custom ID, see AddCustomLiveStreamTranscode.

  3. Generation rules of encoding URL.
    • Streaming URL supports RMTP, FLV, and HLS formats. For encoding URLs in different formats, you must add _templateid following StreamName.
      • RTMP format:rtmp://streaming domain name/AppName/StreamName{_templateid}? authentication string
      • FLV format:http://streamingdomain /AppName/StreamName{_templateid}.flv? authentication string
      • HLS format:http://streamingdomain /AppName/StreamName{_templateid}.m3u8? authentication string
        Note M3u8 encoding URL is already supported. If you have more requirements, Open a ticket.
    • Examples

      For example, the streaming domain name is play.aliyunlive.com, the Application Name is app, the Stream Name is stream, and the authentication key is 456, then the streaming URL is:

      • RTMP-based streaming URL rtmp://play.aliyunlive.com/app/stream_sd? auth_key=timestamp-rand-uid-md5hash
      • FLV-based streaming URL http://play.aliyunlive.com/app/stream_sd.flv? auth_key=timestamp-rand-uid-md5hash
      • HLS-based streaming URL http://play.aliyunlive.com/app/stream_sd.m3u8? auth_key=timestamp-rand-uid-md5hash
    Authentication field description, see Democode.
    Field Description
    timestamp expire time, positive integer, fixed length 10, seconds measured from 1970-01-01. Used to control expire time, integer of 10 digits, expire time 1800s.
    rand random number, we recommend that you use UUID (not including hyphen“-”, for example, 477b3bbc253f467b8def6711128c7bec format)
    uid not used yet (set to 0)
    md5hash verification string calculated according to md5 algorithm, lowercase letters and digits (0-9 and a-z) are supported, fixed length 32