ApsaraVideo Real-time Communication (ARTC) supports composing multiple streams according to specific rules and relaying the composed stream to ApsaraVideo Live or third-party live streaming platforms. This allows audiences to pull and watch the composed stream. This topic describes how to enable the composition and relay service.
Use cases
The cloud-based stream composition and relay service mixes the ARTC streams from the client side and relay the composed stream to the Global Realtime Transport Network (GRTN) of ApsaraVideo Live for consumption by live viewers. It is required in ARTC scenarios including, but not limited to, the following:
Multi-host streaming: The viewers enter the live channel to watch the stream and are promoted to the stage to interact with the host.
Chat room: Listeners join an audio room to listen and participate in group voice chat.
Record and review audio and video content during multi-host streaming and audio chats.
Enable stream composition and relay
You can enable the composition and relay service in the following ways.
Global stream relay
When global stream relay is enabled, the stream of each host in the live channel is automatically pushed to GRTN. This method is suitable for interactive live streaming, content review, and recording.
Procedure:
Log on to the ApsaraVideo Live console.
In the left navigation pane, choose . Find the application that you want to manage and click Manage in the Actions column.
Click Stream Relay. You can use one of the following modes to configure stream relay:
Mode 1: Relay of Specified Streams
Call StartLiveMPUTask to configure stream relay for a specific channel in real time. This way, the streams can be relayed to ApsaraVideo Live or a third-party platform. This requires a small amount of development on the server side.
Mode 2: Global Stream Relay to ApsaraVideo Live
After you enable the stream relay feature, audio and video streams are relayed to the origin server of ApsaraVideo Live. You can configure features such as transcoding, recording, and snapshot capture based on streaming domains. You can also pull live streams to watch.
Turn on Stream Relay.
Configure the stream relay parameters.
Parameter
Configuration
Description
Stream Relay
Select an option.
After you enable single-stream relay, all audio and video streams are relayed to ApsaraVideo Live by default. You can still update the layout of a mixed stream by using the SDK or server API.
Streaming Domain
Example: play.example.com
The destination streaming domain for standard streaming. You can play live streams, configure transcoding and recording, and perform other operations based on the streaming domain.
NoteIf you do not have a streaming domain, add one on the Domain Management page.
RTS half-second latency streaming is not supported. Choosing a streaming domain with this feature enabled will result in a stream relay failure.
AppName
The name can be up to 255 characters in length and can contain digits, letters, hyphens (-), underscores (_), and equal signs (=).
Default value: live. You can specify a custom value.
The application name in the streaming URL after stream relay. For more information, see Generate ingest and streaming URLs.
NoteIf you need to configure templates such as transcoding, recording, and snapshot templates for the relayed stream, you must specify an application name that is the same as the application name specified in the templates. Otherwise, the templates do not take effect.
SEI Insertion
Insert SEI at Regular Intervals: This option lets you insert supplemental enhancement information (SEI) at a specified interval from 1,000 to 5,000 ms.
Insert SEI in I-frames: This option lets you insert SEI in I-frames of a video stream.
SEI: You can use SEI to insert basic user information such as the UID and mixed-stream layout parameters into streams. This way, in co-hosting scenarios, when the layout for stream mixing and relay changes, the app that viewers use to watch streams can parse the layout information from SEI in real time. This helps facilitate the adjustment of interaction styles. For more information, see SEI format.
NoteIf no streaming domain is available, add a domain name. For more information, see Add a domain name.
Server-side API calls for composition and relay
When the host starts streaming, the server calls the StartLiveMPUTask API to start stream relay.
When a guest goes on stage for multi-host streaming, the server calls the UpdateLiveMPUTask API to compose and relay the streams.
For more information about guest spot mode of multi-host streaming, see Developer guide to co-streaming.
For more information about VS mode of multi-host streaming, see Developer guide to streamer battles.