All Products
Search
Document Center

ApsaraVideo Live:Generate ingest and streaming URLs

Last Updated:Mar 01, 2024

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 generate 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 generate an ingest URL and a streaming URL for a stream.

Usage notes

  • You can generate multiple ingest or streaming URLs to run multiple live streams at the same time. However, each ingest domain 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, contact us.

  • If you use a transcoding template or enable URL signing, replace the content in braces {} with the actual value. 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.

Method 1: Generate ingest and streaming URLs in the console

You can use the live URL generator in the ApsaraVideo Live console to generate ingest and streaming URLs. For more information, see Live URL generator.

Method 2: Construct ingest and streaming URLs

Before you construct an ingest URL or a streaming URL by using the concatenation rules, confirm 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 concatenation rules.

URL type

Concatenation rule

Sample URL

Ingest URL

Ingest domain + Application name + Stream name + Access token

  • 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 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

To transcode a stream, you must add _Transcoding template ID after 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}

URL for delayed streaming

Streaming domain + Application name + Stream name-alidelay + Access token

You must add -alidelay after the stream name in a URL for delayed streaming.

  • URL for delayed streaming in the RTMP format: rtmp://example.aliyundoc.com/app/stream-alidelay?auth_key={Access token}

  • URL for delayed streaming in the FLV format: http://example.aliyundoc.com/app/stream-alidelay.flv?auth_key={Access token}

  • URL for delayed streaming in the M3U8 format: http://example.aliyundoc.com/app/stream-alidelay.m3u8?auth_key={Access token}

  • URL for delayed streaming in the RTS format: artc://example.aliyundoc.com/app/stream-alidelay?auth_key={Access token}

Note
  • Before you use a URL in the Real-Time Streaming (RTS) format, you must enable the RTS feature. For more information, see Enable RTS.

  • 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, contact us to enable the application isolation feature.

  • If you need to only pull streams, the ingest domain is not required.

  • 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.

  • A URL for delayed streaming can take effect only after you configure stream delay. You can configure this feature in the ApsaraVideo Live console. For more information, see Configure stream delay. If stream delay is not configured for the streaming domain or live streaming has not started, the URL for delayed streaming cannot be pulled.