All Products
Search
Document Center

ApsaraVideo Live:URLs for co-streaming

Last Updated:Sep 24, 2024

This topic describes the concatenation rules for the ingest and streaming URLs of streamers and co-streamers in co-streaming scenarios, the ingest and streaming URLs of different streamers in battle scenarios, and the CDN steaming URLs of viewers.

Prerequisites

Important

During co-streaming or battles, the user IDs, including the IDs of streamers and co-streamers, in the same room or in different rooms cannot be the same. Otherwise, conflicts may occur. For example, the streamer in Room A (room ID: A, streamer ID: 111, and co-streamer ID: 222) cannot co-stream or start a battle with the streamer in Room B (room ID: B, streamer ID: 222, and co-streamer ID: 333), because the ID of the co-streamer in Room A is the same as the ID of the streamer in Room B.

Ingest and streaming URLs of streamers and co-streamers in co-streaming scenarios

Before you construct the ingest and streaming URLs of streamers and co-streamers in co-streaming scenarios, obtain the fields that are described in the following table.

Field

Description

artc://

The prefix of the URL. Do not modify this field.

live.aliyun.com

The fixed field in the URL. Do not modify this field.

Note

live.aliyun.com is not a real domain name. Do not perform domain-related operations, such as ping, traceroute, and telent, on it.

push

The fixed field that identifies stream ingest. Do not modify this field.

play

The fixed field that identifies stream pulling. Do not modify this field.

roomId

The custom room ID. The streamer and co-streamer must use the same room ID.

The ID can be up to 64 characters in length and can contain digits, letters, hyphens (-), underscores (_), and equal signs (=).

sdkAppId

The ID of the ARTC application. The ID is automatically generated when you create the ARTC application in the ApsaraVideo Live console. For more information, see Configure stream mixing.

userId

The user ID. For the streamer, it is the ID of the streamer. For the co-streamer, it is the ID of the co-streamer. Make sure that the IDs of the streamer and co-streamer in a room are not the same.

The ID can be up to 64 characters in length and can contain digits, letters, hyphens (-), underscores (_), and equal signs (=).

timestamp

The timestamp after which the URL expires, in seconds. The timestamp cannot be greater than 24 hours from the time when co-streaming starts.

token

The token that is generated based on roomId, timestamp, userId, sdkAppId, and AppKey. For more information, see Token-based authentication.

Assume that:

  • The value of roomId is 123.

  • The value of sdkAppId is d14baa88-****-4111-b5b0-3b2f60d2ef80.

  • The streamer ID is 518.

  • The co-streamer ID is 520.

  • The value of timestamp is 1659583716.

  • The value of token is 2035650c0f7****a53998.

The following table provides examples of URLs that are constructed by using the concatenation rules.

Note

Replace the content in ${} with the actual value.

URL type

Concatenation rule

Example

Streamer

Ingest URL

artc://live.aliyun.com/push/${Room ID}?sdkAppId=${ARTC application ID}&userId=${Streamer ID}&timestamp=${Expiration timestamp}&token=${Token}

Stream ingest over RTC is supported.

Ingest URL based on RTC: artc://live.aliyun.com/push/123?sdkAppId=d14baa88-****-4111-b5b0-3b2f60d2ef80&userId=518&timestamp=1659583716&token=2035650c0f7****a53998

Streaming URL

artc://live.aliyun.com/play/${Room ID}?sdkAppId=${ARTC application ID}&userId=${Streamer ID}&timestamp=${Expiration timestamp}&token=${Token}

Stream pulling over RTC is supported.

Streaming URL based on RTC: artc://live.aliyun.com/play/123?sdkAppId=d14baa88-****-4111-b5b0-3b2f60d2ef80&userId=518&timestamp=1659583716&token=2035650c0f7****a53998

Co-streamer

Ingest URL

artc://live.aliyun.com/push/${Room ID}?sdkAppId=${ARTC application ID}&userId=${Co-streamer ID}&timestamp=${Expiration timestamp}&token=${Token}

Stream ingest over RTC is supported.

Ingest URL based on RTC: artc://live.aliyun.com/push/123?sdkAppId=d14baa88-****-4111-b5b0-3b2f60d2ef80&userId=520&timestamp=1659583716&token=2035650c0f7****a53998

Streaming URL

artc://live.aliyun.com/play/${Room ID}?sdkAppId=${ARTC application ID}&userId=${Co-streamer ID}&timestamp=${Expiration timestamp}&token=${Token}

Stream pulling over RTC is supported.

Streaming URL based on RTC: artc://live.aliyun.com/play/123?sdkAppId=d14baa88-****-4111-b5b0-3b2f60d2ef80&userId=520&timestamp=1659583716&token=2035650c0f7****a53998

Ingest and streaming URLs of different streamers in battle scenarios

Before you construct the ingest and streaming URLs of Streamer A and Streamer B in a battle, obtain the fields that are described in the following table.

Field

Description

artc://

The prefix of the URL. Do not modify this field.

live.aliyun.com

The fixed field in the URL. Do not modify this field.

push

The fixed field that identifies stream ingest. Do not modify this field.

play

The fixed field that identifies stream pulling. Do not modify this field.

roomId

The custom room ID. Streamers who join the battle must use different room IDs.

The ID can be up to 64 characters in length and can contain digits, letters, hyphens (-), underscores (_), and equal signs (=).

sdkAppId

The ID of the ARTC application. The ID is automatically generated when you create the ARTC application in the ApsaraVideo Live console. For more information, see Configure stream mixing.

userId

The custom streamer ID. Streamers who join the battle must use different streamer IDs.

The ID can be up to 64 characters in length and can contain digits, letters, hyphens (-), underscores (_), and equal signs (=).

timestamp

The timestamp after which the URL expires, in seconds. The timestamp cannot be greater than 24 hours from the time when the battle starts.

token

The token that is generated based on roomId, timestamp, userId, sdkAppId, and AppKey. For more information, see Token-based authentication.

Assume that:

  • The room ID of Streamer A is 111.

  • The room ID of Streamer B is 222.

  • The value of sdkAppId is d14baa88-****-4111-b5b0-3b2f60d2ef80.

  • The ID of Streamer A is 125.

  • The ID of Streamer B is 396.

  • The value of timestamp is 1659583716.

  • The value of token is 2035650c0f7****a53998.

The following table provides examples of URLs that are constructed by using the concatenation rules.

Note

Replace the content in ${} with the actual value.

URL type

Concatenation rule

Example

Streamer A

Ingest URL

artc://live.aliyun.com/push/${Room ID of Streamer A}?sdkAppId=${ARTC application ID}&userId=${ID of Streamer A}&timestamp=${Expiration timestamp}&token=${Token}

Stream ingest over RTC is supported.

Ingest URL based on RTC: artc://live.aliyun.com/push/111?sdkAppId=d14baa88-****-4111-b5b0-3b2f60d2ef80&userId=125&timestamp=1659583716&token=2035650c0f7****a53998

Streaming URL

artc://live.aliyun.com/play/${Room ID of Streamer A}?sdkAppId=${ARTC application ID}&userId=${ID of Streamer A}&timestamp=${Expiration timestamp}&token=${Token}

Stream pulling over RTC is supported.

Streaming URL based on RTC: artc://live.aliyun.com/play/111?sdkAppId=d14baa88-****-4111-b5b0-3b2f60d2ef80&userId=125&timestamp=1659583716&token=2035650c0f7****a53998

Streamer B

Ingest URL

artc://live.aliyun.com/push/${Room ID of Streamer B}?sdkAppId=${ARTC application ID}&userId=${ID of Streamer B}&timestamp=${Expiration timestamp}&token=${Token}

Stream ingest over RTC is supported.

Ingest URL based on RTC: artc://live.aliyun.com/push/222?sdkAppId=d14baa88-****-4111-b5b0-3b2f60d2ef80&userId=396&timestamp=1659583716&token=2035650c0f7****a53998

Streaming URL

artc://live.aliyun.com/play/${Room ID of Streamer B}?sdkAppId=${ARTC application ID}&userId=${ID of Streamer B}&timestamp=${Expiration timestamp}&token=${Token}

Stream pulling over RTC is supported.

Streaming URL based on RTC: artc://live.aliyun.com/play/222?sdkAppId=d14baa88-****-4111-b5b0-3b2f60d2ef80&userId=396&timestamp=1659583716&token=2035650c0f7****a53998

CDN streaming URLs of viewers

Note

A CDN streaming URL of viewers is the CDN streaming URL of the room where the streamer resides. Different rooms have different CDN streaming URLs. When you construct a CDN streaming URL of viewers, use the room ID of the viewers and the streamer ID in the same room.

In battle scenarios, viewers in different rooms of the streamers need to use the CDN streaming URLs of the corresponding rooms for playback. For example, Viewer C is watching Streamer A. When Streamer A starts a battle with another streamer, Viewer C uses the CDN streaming URL of the room of Streamer A to watch the battle.

Before you construct the CDN streaming URLs of viewers, obtain the fields that are described in the following table.

Field

Description

Protocol prefix

URLs in the Real-Time Messaging Protocol (RTMP), Flash Video (FLV), M3U8, and Real-Time Streaming (RTS) formats are supported. The corresponding protocol prefixes are: rtmp://, http://, http://, and artc://.

Streaming domain

The streaming domain. For information about how to configure the streaming domain for the ARTC application in the ApsaraVideo Live console, see Configure stream mixing.

AppName

The custom name of the application used for co-streaming. The name can be up to 255 characters in length and can contain digits, letters, hyphens (-), underscores (_), and equal signs (=).

StreamId

Construct StreamId based on multiple fields in the ingest URL. Concatenation rules:

  • For a video stream, the value of StreamId is ${ARTC application ID}_${Room ID}_${Streamer ID}_camera.

  • For an audio-only stream, the value of StreamId is ${ARTC application ID}_${Room ID}_${Streamer ID}_audio.

auth_key

Note

This field is required only if URL signing is enabled.

An access token is an encrypted string that is generated based on the URL signing algorithm. You must enable URL signing before access tokens can be generated. 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.

Note

The last part of the StreamId field specifies the type of input stream:

  • camera: the video stream captured by the camera.

  • shareScreen: the video stream of screen sharing.

  • audio: the audio stream captured by the microphone.

If the ARTC application ID is d14baa88-****-4111-b5b0-3b2f60d2ef80, the room ID is 123, and the streamer ID is 518:

  • For a video stream, the value of StreamId is d14baa88-****-4111-b5b0-3b2f60d2ef80_123_518_camera.

  • For an audio-only stream, the value of StreamId is d14baa88-****-4111-b5b0-3b2f60d2ef80_123_518_audio.

If the streaming domain is example.alivecdn.com and the value of auth_key is 16632272****fd016c6d85f:

  • For a video stream, the value of StreamId is d14baa88-****-4111-b5b0-3b2f60d2ef80_123_518_camera.

  • For an audio-only stream, the value of StreamId is d14baa88-****-4111-b5b0-3b2f60d2ef80_123_518_audio.

The following table provides examples of URLs that are constructed by using the concatenation rules.

Note
  • We recommend that you use a URL in the HTTP-FLV format for playback.

    A URL in the RTMP format and a URL in the HTTP-FLV format contain the same data content, but use different channels. HTTP is the primary protocol for transmission of information across the Internet. Connections over the HTTP protocol, such as connections among Alibaba Cloud CDN, Internet service providers (ISPs), and intermediary devices, are highly optimized. The default port for the HTTP protocol is 80 and the default port for the HTTPS protocol is 443. In most cases, the ports are added to the whitelist and cannot be disabled. RTMP is an outdated protocol and uses 1935 as the default port. Port 1935 may be disabled by the firewall. This may cause errors. Compared with RTMP, HTTP-FLV is more stable and provides better performance. For example, video playback over HTTP-FLV has a lower stuttering rate and lower latency than RTMP.

  • Replace the content in ${} with the actual value.

URL type

Concatenation rule

Example

CDN streaming URL

Streaming URL

  • RTMP format: rtmp://${Streaming domain}/live/${StreamId}?auth_key=${Token}

  • FLV format: http://${Streaming domain}/live/${StreamId}.flv?auth_key=${Token}

  • M3U8 format: http://${Streaming domain}/live/${StreamId}.m3u8?auth_key=${Token}

  • RTS format: artc://${Streaming domain}/live/${StreamId}?auth_key=${Token}

Streaming URLs support the RTMP, FLV, M3U8, and RTS formats.

  • For a video stream:

    • RTMP format: rtmp://example.alivecdn.com/live/d14baa88-****-4111-b5b0-3b2f60d2ef80_123_518_camera?auth_key=16632272****fd016c6d85f

    • FLV format: http://example.alivecdn.com/live/d14baa88-****-4111-b5b0-3b2f60d2ef80_123_518_camera.flv?auth_key=16632272****fd016c6d85f

    • M3U8 format: http://example.alivecdn.com/live/d14baa88-****-4111-b5b0-3b2f60d2ef80_123_518_camera.m3u8?auth_key=16632272****fd016c6d85f

    • RTS format: artc://example.alivecdn.com/live/d14baa88-****-4111-b5b0-3b2f60d2ef80_123_518_camera?auth_key=16632272****fd016c6d85f

  • For an audio-only stream:

    • RTMP format: rtmp://example.alivecdn.com/live/d14baa88-****-4111-b5b0-3b2f60d2ef80_123_518_audio?auth_key=16632272****fd016c6d85f

    • FLV format: http://example.alivecdn.com/live/d14baa88-****-4111-b5b0-3b2f60d2ef80_123_518_audio.flv?auth_key=16632272****fd016c6d85f

    • M3U8 format: http://example.alivecdn.com/live/d14baa88-****-4111-b5b0-3b2f60d2ef80_123_518_audio.m3u8?auth_key=16632272****fd016c6d85f

    • RTS format: artc://example.alivecdn.com/live/d14baa88-****-4111-b5b0-3b2f60d2ef80_123_518_audio?auth_key=16632272****fd016c6d85f