This topic describes the integration flow for stream mixing and transcoding.
Prerequisites
An Alibaba Cloud account is created and real-name verification is complete. To create an Alibaba Cloud account, visit the Alibaba Cloud official website. For more information, see Create an Alibaba Cloud account. For information about real-name verification, see Individual identity verification or Enterprise real-name verification.
You have activated the Real-Time Communication service. For more information, see Activate the service.
You have created an application in the Real-Time Communication console. For more information, see Create an application.
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 |
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. |