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
- A co-streaming application is created. For more information, see Create a co-streaming 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 a domain name. For more information about how to associate a streaming domain with an ingest domain, see Bind a stream pushing domain to a streaming domain.
Ingest and streaming URLs of streamers and co-streamers in co-streaming scenarios
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. 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 co-streaming application. The ID is automatically generated when you create the co-streaming 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. |
- 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.
URL type | Concentration rule | Example | |
---|---|---|---|
Streamer | Ingest URL | artc://live.aliyun.com/push/${Room ID}?sdkAppId=${Co-streaming 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=${Co-streaming 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=${Co-streaming 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=${Co-streaming 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
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 co-streaming application. The ID is automatically generated when you create the co-streaming 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. |
- 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.
URL type | Concentration rule | Example | |
---|---|---|---|
Streamer A | Ingest URL | artc://live.aliyun.com/push/${Room ID of Streamer A}?sdkAppId=${Co-streaming 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=${Co-streaming 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=${Co-streaming 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=${Co-streaming 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
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.
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 co-streaming application in the ApsaraVideo Live console, see Configure stream mixing. |
AppName | The name of the application used for co-streaming. Set the value to live. |
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 access tokens. For more information, see Configure URL signing. You can also use the MD5 algorithm to obtain access tokens. For more information, see Construct a signed URL. |
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
.
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
.
- 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 | Concentration rule | Example | |
---|---|---|---|
CDN streaming URL | Streaming URL |
| Streaming URLs support the RTMP, FLV, M3U8, and RTS formats.
|