In order to make developers have a more intuitive experience of the interaction with mi-mac, anyRTC launched voice mi-Mac Demo, so that developers can not only understand the concept, but also have more practical operation, learn from the process, and make it easier to create their own product scenes.
AnyRTC has been adapted to iOS, Androd, Web, applets, Windows, macOS and Linux. There are also cross-platform series, Flutter, Uni-App, APICloud. Developers can choose according to their own company. AnyRTC will spare no effort to help you create a perfect feast on the audio and video scene.
The paper
Voice communication is an essential function of social software. Compared with text and pictures, voice communication is richer and simpler than video. In addition to the simple one-on-one voice chat in the past, with the rapid development of real-time audio and video technology, there are many interesting ways to play.
Classification and gameplay of voice Link APP
-
Live voice broadcasting
-
The game opens black class
-
Chat room class
-
Voice games
Currently, black-opening apps on the market can be roughly divided into the above four categories. Because different kinds of apps target different groups of people, there are also some differences in gameplay.
Live voice broadcasting
At present more fire is the voice even mai play. The roles are divided into the anchor and the audience. The anchor can sing in his studio, tell stories, talk shows and have various forms of content. The audience can also take the initiative to chat and interact with the anchor on the mic. The main function is to connect the voice. On the basis of chat, the background accompaniment sound and text message function through message system are added. It seems simple, but users in this mode are more active and willing to pay, and some good voice social platforms can achieve high turnover.
The game opens black class
Black apps are mainly used as a medium for voice communication during games, because there are often noise, voice delay, or unclear hearing problems when playing games together. Voice black app perfectly solves these problems, allowing you to maintain normal voice communication while playing games and improve user experience.
Chat room class
Chat room app is a hot category at present. After entering the chat room, each room is its own theme, users can express their opinions in the room, while supporting voice change. If you don’t want to speak, you can also choose the audience mode. You can also listen or send a bullet screen without participating in the interaction.
Voice games
Voice game, it is also a common voice chat room application scenario. From the popular werewolf kill and scripted kill, more and more games have begun to create real-time interactive scenes for players, while real-time audio and video dialogue has become a major feature of some game genres. Functionally, it is similar to live voice, except that in this channel, the gameplay logic is different.
How to implement voice chat room
These are just some of the scenarios for voice chat. To sum up, the main functions that voice chat rooms need to meet include:
-
Supports voice chat with multiple participants
-
Local mixing is supported
-
Multiple linmac modes
To achieve a voice chat room with the above functions, it can be roughly divided into three steps: to achieve voice connectivity, support local mixing, a variety of connectivity mode design.
The first is the realization of voice link. If it is to be realized through self-research, it will be quite difficult:
-
You need to deploy your own server to handle high concurrency.
-
Need to optimize the codec to solve the echo, noise problems;
-
Mature technical solutions are needed to reduce latency and improve sound quality;
-
It must be compatible with user experience in various network environments.
Generally speaking, it is necessary to solve the problem of low latency and availability of voice connection between devices and networks.
The following figure shows the architecture diagram and implementation ideas of the voice chat room scenario-based scheme:
Enabling voice connection
Usually, a series of operations, such as audience request and anchor application, are completed by message service. In any mode, after entering the room, the listener can be allowed to go on the phone. The user issues an application for going on the phone. After the owner agrees, the listener can go on the phone.
At present anyRTC provides two voice connection modes, which are local confluence and server confluence.
Here is a way to introduce local confluence:
Local confluence
1, the introduction of
This scheme is a local confluence scheme. The host terminal interacts with the connected terminal in real time. The host terminal performs audio and video mixing locally and pushes the streaming to RTMP.
2. Program flow chart
3. Call the sequence diagram
The anchor end:
Client:
Process: After the visitor initializes RTC, initializes the player, and plays RTMP. After the application for connecting to the mic passes, the user calls the method of adding channel. After joining the channel successfully, the user stops playing RTMP. After the mic is down, call leaveChannel and call player to play the RTMP stream:
4. Supporting SDK
Real-time message SDK: The RTM SDK is used for signaling interaction to apply for the delivery of the messages including the link, consent, and rejection. Messages are sent to the back seat for corresponding logic processing.
Real-time AUDIO and video SDK: The RTC SDK is used for audio and video communication, and the corresponding SDK is used according to the user’s role
Local confluence class: anchor side call, responsible for local audio stream synthesis and push to RTMP
Player class: visitor side call, responsible for playing RTMP, stop playing when on the mic, and call RTC to join the room, when the mic, leave the channel, and continue to call the player play.
Next, let’s introduce the way of server-side convergence:
Server confluence
1, the introduction of
This scheme is a server-side confluence scheme, in which the host terminal interacts with the host terminal in real time, and the host terminal invokes methods to update the confluence layout of the service in real time.
2. Program flow chart
3. Call the sequence diagram
The anchor end:
Process: After initializing THE RTC, the anchor sets the channel attribute to live broadcast mode, and sets his role as the main broadcast. After joining the channel successfully, the anchor sets the push flow code configuration and the push flow address to push the stream. If a user updates the streaming configuration on or off the mic, the server updates the merging operation based on the configuration.
Tourists end:
Process: After the visitor initializes RTC, initializes the player, and plays RTMP. After the application for connecting to the mic passes, the user calls the method of adding channel. After joining the channel successfully, the user stops playing RTMP. After the mic is down, call leaveChannel and call player to play the RTMP stream:
4. Supporting SDK
Real-time message SDK: The RTM SDK is used for signaling interaction to apply for the delivery of the messages including the link, consent, and rejection. Messages are sent to the back seat for corresponding logic processing.
Real-time AUDIO and video SDK: The RTC SDK is used for audio and video communication, and the corresponding SDK is used according to the user’s role
Player class: visitor side call, responsible for playing RTMP, stop playing when on the mic, and call RTC to join the room, when the mic, leave the channel, and continue to call the player play.
The Demo presentation
The anchor end
www.bilibili.com/video/BV1Nh…
Visitors to the
www.bilibili.com/video/BV1KK…
Demo functions:
Send barrage: Real-time message interaction.
Application on the mic: Application on the MIC and off the MIC.
Music playback: Mix background music and host voice for playback.
Control volume: you can adjust music, human voice, and ear sound.
Download link
The Android client: www.pgyer.com/fRjW
The iOS side: www.pgyer.com/PGLT
The above is the general introduction of anyRTC voice with Mai Demo, welcome to download experience. For more information about audio and video consultation, please pay attention to anyRTC’s official website: www.anyrtc.io/