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, you can use the concatenating rules to construct an ingest URL and a streaming URL. Before you start, make sure that both the ingest domain and streaming domain have Internet content provider (ICP) filings and that the settings such as domain name resolution and URL signing are complete. This topic describes how to construct an ingest URL and a streaming URL for a stream by using the concatenating rules.

Limits

You can construct multiple ingest or streaming URLs to run multiple live streams at the same time. However, each domain name allows a limited number of concurrent streams. For more information, see Limits. Before you start live streaming, make sure that such limits meet your business requirements. If you want to modify the limits, submit a ticket. For more information, see Contact us.

Generate ingest and streaming URLs

You can use the URL generator in the ApsaraVideo Live console or use the concatenating rules to generate ingest and streaming URLs.

  • For more information about how to use the URL generator in the ApsaraVideo Live console to generate ingest and streaming URLs, see URL generator.
  • Before you construct an ingest URL or a streaming URL for a stream by using the concatenating rules, check whether the live stream requires transcoding and URL signing. Then, obtain the ingest domain, streaming domain, application name, stream name, transcoding template ID, and access token. The transcoding template ID and access token are optional. The following table describes the concatenating rules.
    URL type Concatenating rule Sample URL
    Ingest URL Ingest domain + Application name + Stream name + Access token Ingest URLs support the Real-Time Messaging Protocol (RTMP), Real-Time Streaming (RTS), and Secure Reliable Transport (SRT) formats. Ingest URLs in the RTS format are used for RTS. Before you use an ingest URL in the RTS format, you must enable the RTS feature.
    • Ingest URL in the RTMP format: rtmp://demo.aliyundoc.com/app/stream?auth_key={Access token}
    • Ingest URL in the RTS format: artc://demo.aliyundoc.com/app/stream?auth_key={Access token}
    • Ingest URL in the SRT format: srt://demo.aliyundoc.com:1105?streamid=#!::h=demo.aliyundoc.com,r=/app/stream?auth_key={Access token},m=publish
      Note Take note that m=publish is not included in the access token of an ingest URL in the SRT format. Example: srt://demo.aliyunlive.com:1105?streamid=#!::h=demo.aliyunlive.com,r=/1/1?auth_key=1661312655-0-0-3fded78b61b14071****aa6e6d2,m=publish.
    Streaming URL Streaming domain + Application name + Stream name + Access token

    Streaming URLs support the RTMP, Flash Video (FLV), M3U8, and RTS formats. Streaming URLs in the RTS format are used for RTS. Before you use a streaming URL in the RTS format, you must enable the RTS feature.

    • Streaming URL in the RTMP format: rtmp://example.aliyundoc.com/app/stream?auth_key={Access token}
    • Streaming URL in the FLV format: http://example.aliyundoc.com/app/stream.flv?auth_key={Access token}
    • Streaming URL in the M3U8 format: http://example.aliyundoc.com/app/stream.m3u8?auth_key={Access token}
    • Streaming URL in the RTS format: artc://example.aliyundoc.com/app/stream?auth_key={Access token}
    Transcoded stream URL Streaming domain + Application name + Stream name_Transcoding template ID + Access token Transcoded stream URLs support the RTMP, FLV, M3U8, and RTS formats. Transcoded stream URLs in the RTS format are used for RTS. Before you use a transcoded stream URL in the RTS format, you must enable the RTS feature. To transcode a stream, you must append _Transcoding template ID to the stream name.
    • Transcoded stream URL in the RTMP format: rtmp://example.aliyundoc.com/app/stream_{Transcoding template ID}?auth_key={Access token}
    • Transcoded stream URL in the FLV format: http://example.aliyundoc.com/app/stream_{Transcoding template ID}.flv?auth_key={Access token}
    • Transcoded stream URL in the M3U8 format: http://example.aliyundoc.com/app/stream_{Transcoding template ID}.m3u8?auth_key={Access token}
    • Transcoded stream URL in the RTS format: artc://example.aliyundoc.com/app/stream_{Transcoding template ID}?auth_key={Access token}
    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 to contact Alibaba Cloud technical support. For more information, see Contact us.
    • Replace the content in braces {} with the actual value.
    • If you need to only pull streams, the ingest domain is not required.
    • An access token is an encrypted string that is generated based on the URL signing algorithm. You must enable the URL signing feature to generate an access token. You can enable the URL signing feature in the ApsaraVideo Live console and obtain the access token. For more information, see Configure URL signing. You can also use the MD5 algorithm to generate the access token. For more information, see Construct a signed URL.
    • You must provide a transcoding template ID to generate a transcoded stream URL. You can specify or view the ID of a transcoding template in the ApsaraVideo Live console. For more information, see Configure default transcoding. You can also call the AddCustomLiveStreamTranscode or DescribeLiveStreamTranscodeInfo operation to specify or obtain the ID of a transcoding template.