ApsaraVideo Live allows you to ingest and play live streams on demand without the need to create resources in advance. After you add an ingest domain and a streaming domain that have Internet content provider (ICP) filings and perform the required operations such as domain resolution and URL signing, you can construct an ingest URL and a streaming URL based on the concatenating rules. This topic shows you how to construct an ingest URL and a streaming URL for a stream and how to use the URLs.

Concatenating rules

An ingest URL or a streaming URL is constructed based on the three-level structure of a domain name, the AppName parameter that indicates an application name, and the StreamName parameter that indicates a stream name. A domain name can contain multiple applications and an application can contain multiple streams.

You can specify a custom application name and a custom stream name to construct a URL. Ingest URLs and streaming URLs vary based on the specified application name and stream name.

Before you construct an ingest URL and a streaming URL for a stream, check whether the stream requires transcoding and whether the URL signing feature is enabled. In addition, obtain an ingest domain, a streaming domain, an application name, a stream name, a transcoding template ID, and an access token. The transcoding template ID and access token are optional.

Note An access token is an encrypted string that is calculated based on the URL signing algorithm.
  • Signed ingest URL: Ingest domain + Application name + Stream name + Access token
  • Signed streaming URL: Streaming domain + Application name + Stream name + Access token
  • Signed streaming URL for transcoding: Streaming domain + Application name + Stream name + _ + Transcoding template ID + Access token
  • Unsigned ingest URL: Ingest domain + Application name + Stream name
  • Unsigned streaming URL: Streaming domain + Application name + Stream name
  • Unsigned streaming URL for transcoding: Streaming domain + Application name + Stream name + _ + Transcoding template ID

Prerequisites

Before you construct an ingest URL or a streaming URL, make sure that you have performed the following operations:

  1. Add domain names

    You must first add an ingest domain and a streaming domain that have ICP filings. For more information about the domain names for CDN, see the "Add a domain name" section of the Add a domain name topic. For more information about how to add domain names, see Add a domain name and Configure a CNAME record.

  2. Bind the domain names

    After you add the domain names, you must bind the ingest domain to the streaming domain so that you can ingest and play streams. For more information about the overall procedure of binding domain names, see the "Bind the domain names" section of the Bind the domain names topic. For more information about the detailed operations in the ApsaraVideo Live console, see Bind an ingest domain to a streaming domain.

  3. Configure URL signing
    By default, URL signing is enabled. We recommend that you keep this feature enabled to prevent illegal recording and distribution. You can use the default URL signing or custom URL signing. For more information about URL signing, see URL signing. For more information about the detailed operations, see Configure URL signing.
    Note In some cases, you may be unable to enable URL signing. Before you disable URL signing for the first time, make sure that you understand the risk of unauthorized use of your service and agree to the Terms for Disabling URL Authentication.
  4. Configure the optional features.

Construct an ingest URL and a streaming URL

You can use the URL generator in the ApsaraVideo Live console or use the concatenating rules to construct an ingest URL and a streaming URL.

  • Use the URL generator

    Go to the URL Generator Management page of the ApsaraVideo Live console. Select a streaming domain and an ingest domain that is bound to the streaming domain. Enter an application name and a stream name. Select a transcoding template as required. Then, click Generate URLs to construct an ingest URL and a streaming URL. For more information, see Use the URL generator.

  • Use the concatenating rules

    Obtain the following information and use the information to manually construct URLs based on the concatenating rules:

    • A streaming domain and an ingest domain that is bound to the streaming domain
    • An application name and a stream name
    • An access token (required if URL signing is enabled)
      • To obtain an access token in the ApsaraVideo Live console, perform the following steps: Click Domain Management in the left-side navigation pane. On the Domain Management page, click Domain Settings in the Actions column of a domain name. On the page that appears, click Access Control on the left side. Then, click the URL Authentication tab and set the parameters as required. For more information, see Configure URL signing.
      • You can also obtain an access token by using the MD5 algorithm. For more information, see Signed URL.
    • A transcoding template ID (required if you want to construct a streaming URL for a stream that requires transcoding)

      You can obtain a template ID by using one of the following methods:

      • Log on to the ApsaraVideo Live console. Click Domain Management in the left-side navigation pane. On the Domain Management page, click Domain Settings in the Actions column of a domain name. On the page that appears, click Transcoding Settings on the left side. Then, view the ID of an existing transcoding template or create a custom transcoding template as required.
      • Call a specific API operation to obtain a template ID.

        To obtain the ID of an existing transcoding template, call the DescribeLiveStreamTranscodeInfo operation.

        Alternatively, you can create a custom transcoding template by calling the AddCustomLiveStreamTranscode operation and use the template ID that you specify when you create the template.

Construct multiple ingest and streaming URLs at a time

To ingest and play a stream, you must use an ingest URL and a streaming URL. ApsaraVideo Live allows you to ingest and play multiple streams on demand without the need to calling API operations.

To batch create live streams, you can construct multiple ingest URLs at a time. Take note of the following limits on concurrent streams. Each domain name can concurrently ingest up to 20 streams or 10 transcoded streams. Make sure that such limits do not affect your live streaming business. If you require larger quotas, submit a ticket.

  • Construct multiple ingest URLs at a time

    You can specify a custom application name and a custom stream name to construct a URL. Ingest URLs and streaming URLs vary based on the specified application name and stream name.

    • An application can contain multiple streams.

      Assume that you have created an application named live. Under the live application, you can create multiple streams. Ingest URLs for the streams:

      rtmp://Ingest domain/{live}/{1}?Access token

      rtmp://Ingest domain/{live}/{2}?Access token

      rtmp://Ingest domain/{live}/{3}?Access token

    • You can also create multiple application-based streams.
      Note ApsaraVideo Live determines whether a stream is unique based on the stream name instead of the application name. If you have specified a unique application name, you must also specify a unique stream name to ensure that the stream is unique.

      rtmp://Ingest domain/{live1}/{Stream1}?Access token

      rtmp://Ingest domain/{live2}/{Stream2}?Access token

      rtmp://Ingest domain/{live3}/{Stream3}?Access token

  • Construct multiple streaming URLs at a time

    Assume that the ingest URL is rtmp://Ingest domain/{live}/{3}?Access token.

    The corresponding streaming URLs are:
    • Real-Time Messaging Protocol (RTMP) format: rtmp://Streaming domain/{live}/{3}?Access token
    • Flash Video (FLV) format: http://Streaming domain/{live}/{3}.flv?Access token
    • HTTP Live Streaming (HLS) format: http://Streaming domain/{live}/{3}.m3u8?Access token
    • User Datagram Protocol (UDP) format: artc://Streaming domain/{live}/{3}?Access token

Sample URLs

Note The sample ingest and streaming URLs in this topic are constructed based on the following information. The sample URLs are for reference only.
  • Ingest domain: push.a.com
  • Streaming domain: play.a.com
  • Application name: app
  • Stream name: stream
  • Transcoding template ID: sd

You must use your ingest domain, streaming domain, application name, stream name, and access token to construct URLs based on the concatenating rules. The access token can be obtained based on the cryptographic key.

Require URL signing URL type Require transcoding Example
Yes Ingest URL N/A Only streams in the RTMP format can be ingested.

rtmp://push.a.com/app/stream?auth_key=160871****-0-0-4c027af1df9237568c7035c290b0****

Streaming URL No

Streaming URLs support the RTMP, FLV, HLS, and UDP formats. The UDP format is used for streaming URLs for real-time streaming (RTS). To use the UDP format, you must enable the RTS feature in advance.

  • RTMP format: rtmp://play.a.com/app/stream?auth_key=160871****-0-0-4c027af1df9237568c7035c290b0****
  • FLV format: http://play.a.com/app/stream.flv?auth_key=160871****-0-0-4c027af1df9237568c7035c290b0****
  • HLS format: http://play.a.com/app/stream.m3u8?auth_key=160871****-0-0-4c027af1df9237568c7035c290b0****
  • UDP format: artc://play.a.com/app/stream?auth_key=160871****-0-0-4c027af1df9237568c7035c290b0****
Yes Streaming URLs support the RTMP, FLV, HLS, and UDP formats. The UDP format is used for the streaming URL of RTS. To use the UDP format, you must enable the RTS feature in advance. To transcode a stream, you must append the _Template ID string to the stream name.
  • RTMP format: rtmp://play.a.com/app/stream_sd?auth_key=160871****-0-0-4c027af1df9237568c7035c290b0****
  • FLV format: http://play.a.com/app/stream_sd.flv?auth_key=160871****-0-0-4c027af1df9237568c7035c290b0****
  • HLS format: http://play.a.com/app/stream_sd.m3u8?auth_key=160871****-0-0-4c027af1df9237568c7035c290b0****
  • UDP format: artc://play.a.com/app/stream_sd?auth_key=160871****-0-0-4c027af1df9237568c7035c290b0****
No Ingest URL N/A Only streams in the RTMP format can be ingested.

rtmp://push.a.com/app/stream

Streaming URL No Streaming URLs support the RTMP, FLV, HLS, and UDP formats. The UDP format is used for the streaming URL of RTS. To use the UDP format, you must enable the RTS feature in advance.
  • RTMP format: rtmp://play.a.com/app/stream
  • FLV format: http://play.a.com/app/stream.flv
  • HLS format: http://play.a.com/app/stream.m3u8
  • UDP format: artc://play.a.com/app/stream
Yes Streaming URLs support the RTMP, FLV, HLS, and UDP formats. The UDP format is used for the streaming URL of RTS. To use the UDP format, you must enable the RTS feature in advance. To transcode a stream, you must append the _Template ID string to the stream name.
  • RTMP format: rtmp://play.a.com/app/stream_sd
  • FLV format: http://play.a.com/app/stream_sd.flv
  • HLS format: http://play.a.com/app/stream_sd.m3u8
  • UDP format: artc://play.a.com/app/stream_sd