Integration flow

更新时间:
复制 MD 格式

This topic describes the integration flow for stream mixing and transcoding.

Prerequisites

Integration flow: Automatic stream mixing and transcoding

Step

Operation

Description

1

Set the SDK channel mode

Call setChannelProfile to set the channel mode. Set the channelProfile parameter to AliRTCSdkInteractiveWithLowLatencyLive (interactive low-latency mode).

Note

This example uses an Android API. The APIs for other platforms are similar.

2

The first client joins the channel

When the first client joins the channel, server-side stream mixing and transcoding are automatically triggered. By default, only the audio from streamers is mixed.

3

The server automatically mixes audio

4

Update video stream mixing parameters

Call the server-side UpdateMPUTask operation to update stream mixing parameters, such as the video stream mixing layout and the user video inputs for the layout.

Note

The TaskId for an interactive low-latency automatic stream mixing job must be generated by the application layer based on the alirtc-mcu-%s%s, appid, channelId rule. For example, if the appid is abc and the channelId is def, the TaskId is alirtc-mcu-abcdef.

5

Clients in the audience automatically subscribe to the mixed stream.

Viewers automatically subscribe to the server-side mixed stream.

Note

At this time, streamers still subscribe to the forwarded video streams (not the mixed stream) from other streamers.

Integration flow: Manual stream mixing and transcoding

Step

Operation

Description

1

Set the SDK channel mode

Call setChannelProfile to set the channel mode. Set the channelProfile parameter to AliRTCSdkCommunication (communication mode) or AliRTCSdkInteractiveLive (interactive mode).

Note

This example uses an Android API. The APIs for other platforms are similar.

2

Join a channel

After a client joins the channel, stream mixing and transcoding are not enabled by default. Call the server-side StartMPUTask operation to start a server-side stream mixing and transcoding job and set the required parameters.

Note

Stream mixing and transcoding jobs can be started only by calling a server-side API.

3

Start and configure stream mixing

4 (Optional)

Update video stream mixing parameters

Call the server-side UpdateMPUTask operation to update stream mixing parameters, such as the video stream mixing layout and the user video inputs for the layout.

5

Audience clients automatically subscribe to the mixed stream.

Viewers automatically subscribe to the server-side mixed stream.

Note

At this time, streamers still subscribe to the forwarded video streams (not the mixed stream) from other streamers.