Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Mini Program multi-person video call

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to achieve Mini Program multi-person video call". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Mini Program multi-person video call how to achieve" it!

Functional experience

Searching for Tencent Video Cloud in WeChat Mini Programs can be loaded into our demo Mini Program, in which the multi-person audio and video function can be used to experience and test the multi-person audio and video call function. For the sake of the beauty of UI and image size, only video calls of up to four people are supported in Demo. You can adjust this value by modifying the limit parameter in the source code.

Technical index

Communication delay: 300ms-800ms

Underlying protocol: based on UDP protocol, audio and video data are segmented and encapsulated in accordance with RTMP standards, supporting packet loss recovery and network adaptation.

Secure encryption: a new pair of asymmetric encryption keys are independently enabled for each connection, and the whole communication process cannot be monitored and tampered with.

Support recording: it can be recorded in the cloud if needed, which is suitable for commercial audio / video solutions such as online customer service and financial account opening, and supports privatization deployment.

Double vs, many people.

Two-person audio and video is as simple as exchanging URL between two sides, but the complexity of the problem increases rapidly from two-person call to multi-person call.

We can leave all the members in the room to Server to manage. Because the information of Server is centralized, there will be no inconsistent BUG, as long as each terminal synchronizes the latest member list from Server to the local (GET LIST) when needed. At the same time, new members can be notified by Server.

To help you better implement Server-based solutions, we recommend that you use RTCRoom solutions:

RTCROOM

The purpose of RTCRoom (RealTime ChatRoom) is to encapsulate all kinds of detailed logic issues that need to be considered in the implementation of two-person or multi-person audio / video, such as room management, status synchronization, message sending and receiving, and so on, so that you only need to face a few very simple interfaces to quickly build your own audio / video capabilities.

Principle interpretation of Client

The Client section of RTCRoom (RTCRoom on Mini Program is an javascript file called rtcroom.js) provides a set of API interfaces:

CreateRoom creates a two-person (or more-person) video chat room, and the person who calls this API is the creator.

EnterRoom

Enter a video call room that has been created, and the person who calls this API is the participant.

ExitRoom exits a video call room. In our default implementation, if the creator exits, the room will be disbanded, and you can adjust it according to your needs.

SendTxtMsg

Sending text messages, used as an auxiliary means of video communication, is usually used to send unimportant system notifications.

Event notification, such as new attendees joining, or someone leaving, etc.

Restrictions on Mini Program

Because Mini Program strictly follows the data-driven design philosophy, it does not support dynamic creation and objects, so we have not been able to allow you to use RTCRoom without paying attention to these two tags, so the Demo code on Mini Program is a little more complex than iOS, Android and Win platforms.

Server

The Server section of the list management RTCRoom is a simple code implementation for room list management and member list management. Take videoconferencing as an example, a company may have multiple videoconferences in progress at the same time, so each meeting is a room, and there are multiple participants in each room. So the management of the room and the management of the members of the room is the work of the Server part.

Event notification

At the same time, Server also has an important responsibility, which is to notify all members of the room through the IM message channel when the room is disbanded and the members go in and out. Since Tencent Cloud already has a very mature IM communication solution, we directly reuse Tencent Cloud IM to notify the status of each member in the room.

Heartbeat mechanism in addition to audio / video links, it is best to add a heartbeat mechanism between Mini Program and Server to identify whether Wechat has crashed unexpectedly. You can also use Tencent Cloud audio / video link interruption notification to achieve the same effect, but the access complexity is much higher. Source download RTCRoom is an open source implementation, with a set of sample source codes on iOS,Android,Windows, Mini Program, and the server side. The client source code mainly provides CreateRoom, EnterRoom, ExitRoom and other APIs for entering and leaving the room, while the server source code is used for room management and sends event notifications to room members through Tencent Cloud IM service. Operating system download link source location wxlite folder in Mini Program DOWNLOAD Mini Program source code zip package server DOWNLOAD Mini Program source code zip package server folder iOSDOWNLOADSDK development kit RtcRoom.mAndroidDOWNLOADSDK development kit RtcRoom.javaWindowsDOWNLOADDemo source code RTCRoom.h+RTCRoom.cpp in the source code

The internal directory structure of the source code package on Mini Program:

RTMPRoom ├── README.md ├── server / / background code directory See ├── wxlite / / Tencent Video Cloud Mini Program directory ├── ├── pages / / Tencent Video Cloud Mini Program interface home directory ├── main / / Tencent Video Cloud Mini Program main interface ├── liveroom / / Tencent Video Cloud Mini Program LVB later in the document. Experience room ├── ├──── roomlist// Tencent Video cloud Mini Program live broadcast experience room list interface ├── ├──── room / / Tencent Video cloud Mini Program live broadcast experience room interface ├── doubleroom / / Tencent Video cloud Mini Program double audio and video ├── ├ ──── roomlist// Tencent Video Cloud Mini Program online list ├── ├──── room / / Tencent Video Cloud Mini Program double audio and video chat interface ├── multiroom / / Tencent Video Yun Mini Program multi-person audio and video ├── ├──── roomlist// Tencent Video Yun Xiao Program multi-person audio and video online list ├── ├──── room / / Tencent Video cloud Mini Program multi-person audio and video chat interface ├── cameraview / / Tencent Video cloud Mini Program double, Multi-person chat push Custom component ├── play / / Tencent Video Cloud Mini Program playback interface ├── push / / Tencent Video Cloud Mini Program push interface ├── rtpplay / / Tencent Video Cloud Mini Program low-latency playback interface ├── vodplay / / Tencent Video Cloud Mini Program VOD playback interface ├── Resources / / Tencent Video Cloud Mini Program Resource Directory ├── ├── lib / / the common library directory used by Mini Program ├── ├── utils / / Tencent Video Cloud Mini Program Interface tool library directory ├── rtcroom.js / / Tencent Video Cloud Mini Program double, Multi-person audio and video library file ├── liveroom.js / / Tencent Video cloud Mini Program one-way audio and video library file └── └── config.js / / configuration file Mainly configure backend server address one-click deployment

It only takes a few mouse clicks to download the source code, but it's not necessarily easy to make RTCRoom run, especially if you don't have a server. With this in mind, we provide a free one-click deployment service. You only need to activate a few Tencent Cloud services for free to quickly build your own debugging environment in 5 minutes.

Two-person scene

RTCRoom can be used not only for multi-person scenarios, but also for two-person video calls, which is much easier than using and building a two-person video call feature from scratch.

At this point, I believe that everyone on "Mini Program multi-person video call how to achieve" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report