Solution overview

Updated at:

The UI-less integration solution encapsulates the voice chat room application programming interface (API). It provides APIs for common features such as channel management, microphone management, background music, sound effects, and audio mixing. This solution does not include any user interface (UI) components. You can use this solution without understanding the model layer logic. It is flexible and supports custom development.

Solution architecture

In the UI-less integration solution, you can integrate the UI-less component library. Then, you can adjust the business implementation of the RoomService interface to use your own instant messaging (IM) or existing server-side interaction protocols. The parts enclosed by dashed lines in the following figure can be implemented by the developer.

image

Interface descriptions

  • ARTCVoiceRoomEngine: A scenario-based API for voice chat rooms. Each API encapsulates the complete business logic. The implementation of each API is shown in the sequence diagrams in this document.

  • ARTCRoomServiceInterface: A channel service interface. Each interface has a single responsibility, such as querying, updating, or sending notifications about channel information and internal status. A default implementation class, ARTCRoomServiceImp, is provided. This class is implemented using services from the app's business server and the interactive message SDK. The source code for the business server is also open source. You can reference it directly or use it for custom development.

  • ARTCRtcService: An API built on the best practices of the ApsaraVideo Real-time Communication SDK. It configures parameters and calls the appropriate ApsaraVideo Real-time Communication SDK APIs for different scenarios, such as voice chat, KTV, and calls.

Business implementation flow

Project components

This business implementation involves the following six components.

  1. AUI: The UI that interacts with the user.

  2. Engine: A scenario-based API for voice chat rooms. Each API encapsulates the complete business logic. For more information about the APIs, see API reference.

  3. RoomService is a channel service that performs operations such as querying and updating channel information and internal status, and sending notifications. This service provides the ARTCRoomServiceInterface interface and its default implementation class, ARTCRoomServiceImp. This class is implemented using the service from your application's business server and the Interactive Message SDK.

  4. RTCService: Encapsulates the Alibaba Cloud ApsaraVideo Real-time Communication service. It provides operations such as joining a mic, stream ingest, leaving a mic, and stopping stream ingest.

  5. AppServer: AppServer provides a set of backend services for the AUI Kits low-code integration tool. Based on services such as Function Compute (FC), these services are quick to deploy and flexible to customize. In this project, it acts as the server-side component responsible for database maintenance and IM group settings.

  6. Interactive Messages: The Alibaba Cloud IM Server service. It is responsible for creating and maintaining IM groups and broadcasting the status of users who join or leave a mic.

Business flow

The voice chat room scenario includes the following six flows, which are listed in order.

  1. A user creates a channel. The user creates a channel and an IM group. The creator becomes the host and automatically enters the channel interface.

  2. A user enters a channel. The user enters an existing channel and joins the IM group. They can send text messages in the channel and listen to the real-time audio of users who are on a mic.

  3. A user requests to join a mic.

  4. A user leaves a mic.

  5. This section describes what happens when a user leaves the channel.

  6. The host dismisses the channel.

The following sequence diagrams provide details about these six flows. The yellow parts (AUI, AppServer, and Interactive Messages) can be modified and replaced by the developer. The blue parts encapsulate the voice chat room scenario API service and can be used directly.

A user creates a channel

This section describes the flow for creating a voice chat room. The streamer calls the `createRoom` interface of the AUI to request that the AppServer create a voice chat room. The AppServer uses the Alibaba Cloud ApsaraVideo Live API to create an IM group. The AppServer then stores information about the voice chat room in the database. This information includes the IM group ID and the microphone status. The user who created the channel becomes the host and automatically enters the channel.

image

A user enters a channel

This section describes the flow for a user to enter a channel. The user enters the channel to retrieve its details, including the list of members who are on a mic. The user also joins the IM group and can send messages to interact in the channel.

image

A user requests to join a mic

This section describes the flow for a user to request to join a mic. The user initiates a request to join a mic. The request is persisted on the AppServer through a series of interface calls and then broadcast to the IM group. After the user successfully joins the mic, RTCService pushes real-time audio to the Alibaba Cloud ApsaraVideo Real-time Communication application.

image

A user leaves a mic

This section describes the flow for a user to leave a mic. The user performs the leave mic operation. The action is persisted on the AppServer through a series of interface calls. After the user successfully leaves the mic, the system stops pushing real-time audio to the Alibaba Cloud ApsaraVideo Real-time Communication application. A broadcast message is then sent to the IM group.

image

A user leaves a channel

This section describes the flow for a user to leave a channel. If a user is on a mic before leaving the channel, the system first executes the A user leaves a mic flow. Then, the user exits the IM group and leaves the channel.

image

The host dismisses a channel

This section describes the flow for a host to dismiss a channel. The AppServer changes the channel status to dismissed and saves this status to the database. Then, a message is broadcast to the IM group to announce that the group is dismissed.

image