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
An ApsaraVideo Real-time Communication (ARTC) application is created. For more information, see Create an ARTC application.
A streaming domain is added, and the streaming domain is associated with an ingest domain. For more information about how to add a streaming domain, see Add an accelerated domain name. For more information about how to associate a streaming domain with an ingest domain, see Associate a streaming domain with an ingest domain.
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.
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}×tamp=${Expiration timestamp}&token=${Token} | Stream ingest over RTC is supported. Ingest URL based on RTC: |
Streaming URL | artc://live.aliyun.com/play/${Room ID}?sdkAppId=${ARTC application ID}&userId=${Streamer ID}×tamp=${Expiration timestamp}&token=${Token} | Stream pulling over RTC is supported. Streaming URL based on RTC: | |
Co-streamer | Ingest URL | artc://live.aliyun.com/push/${Room ID}?sdkAppId=${ARTC application ID}&userId=${Co-streamer ID}×tamp=${Expiration timestamp}&token=${Token} | Stream ingest over RTC is supported. Ingest URL based on RTC: |
Streaming URL | artc://live.aliyun.com/play/${Room ID}?sdkAppId=${ARTC application ID}&userId=${Co-streamer ID}×tamp=${Expiration timestamp}&token=${Token} | Stream pulling over RTC is supported. Streaming URL based on RTC: |
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.
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}×tamp=${Expiration timestamp}&token=${Token} | Stream ingest over RTC is supported. Ingest URL based on RTC: |
Streaming URL | artc://live.aliyun.com/play/${Room ID of Streamer A}?sdkAppId=${ARTC application ID}&userId=${ID of Streamer A}×tamp=${Expiration timestamp}&token=${Token} | Stream pulling over RTC is supported. Streaming URL based on RTC: | |
Streamer B | Ingest URL | artc://live.aliyun.com/push/${Room ID of Streamer B}?sdkAppId=${ARTC application ID}&userId=${ID of Streamer B}×tamp=${Expiration timestamp}&token=${Token} | Stream ingest over RTC is supported. Ingest URL based on RTC: |
Streaming URL | artc://live.aliyun.com/play/${Room ID of Streamer B}?sdkAppId=${ARTC application ID}&userId=${ID of Streamer B}×tamp=${Expiration timestamp}&token=${Token} | Stream pulling over RTC is supported. Streaming URL based on RTC: |
CDN streaming URLs of viewers
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: |
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:
|
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. |
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.
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 |
| Streaming URLs support the RTMP, FLV, M3U8, and RTS formats.
|