# Mini Program audio and video calls (for Hardware)
Access flow and FAQ are also available[WeChat Mini Program audio and video calls (for Hardware) User manual](https://developers.weixin.qq.com/community/Minihome /doc/0008c27a1c87105df45fcab665b001 )
# 1. Product introduction
With WeChat Mini Program audio and video calls (for Hardware) capabilities, hardware developers can use[Mini Program hardware framework(WMPF)](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/), to achieve one-to-one audio and video calls between smart devices and mobile phones on WeChat, to meet real-time touch scenarios and improve the call experience.
The following picture shows the schematic diagram of the mobile phone, authorizing the pop-up window, call reminder, and call interface to provide a unified interface for WeChat, and the hardware Mini Program access to WeChat. VOIP After the call plug-in, the above functions can be achieved.
It is suitable for campus phone, access control, smart door lock, smart central control screen, smart TV, smart camera, smart speaker, smart pension and other devices and scenarios. It supports two-way calls between hardware devices and mobile phones to achieve strong reminder.
# 2. Equipment requirements
Currently supports Android, Linux System, RTOS Equipment of the system.Each device can only bind a Mini Program, and can only talk to a Mini Program.
Currently supported Equipment Direct ConnectandCloud to cloud Two access modes:
- Device Direct Connection: SupportAndroid and Linux equipment• The device side sends and accepts audio and video streams and signaling directly to the WeChat background, and calls the mini program in the user's mobile phone WeChat.
- Cloud-to-cloud support for devices that do not meet the needs of devices directly connected to the hardwareLow power consumption Linux、RTOS Other System EquipmentThe device side only carries out device verification, and the developer background (service side) transfers the video stream and signaling to the WeChat background, and calls the mini program in the user's mobile phone WeChat.
# 2.1 Device Direct Connect (Android)
Android device running Mini Program hardware framework(WMPF),WMPF Run the developer Mini Program in the user's mobile phone and talk directly to the Mini Program in WeChat.
Equipment shall meet the following basic requirements:
- With audio and video capabilities (microphone, camera and other hardware equipment)
- satisfyEquipment Requirements for Mini Program Device Certification
- satisfy[Android Mini Program hardware framework operating requirements](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/#_2-%E4%BA%A7%E5%93%81%E8%83%BD%E5%8A%9B)
- System Version: Suggested Android 7.1 And above version
- CPU: At least quad core 2GHz, video calling is right CPU There are higher requirements
- Memory: at least 2GB RAM + 8GB ROM
- Suggested UseMini Program hardware framework v2.1.0 And above version。
# 2.2 Direct Device Connection (Linux)
Linux System device side call Mini Program audio and video call SDK (Linux), directly with the user's mobile phone WeChat Mini Program call.
Equipment shall meet the following basic requirements:
- With audio and video capabilities (microphone, camera and other hardware equipment)
- satisfyEquipment Requirements for Mini Program Device Certification
- Meet the Run Mini Program audio and video call SDK (Linux) The equipment requirements.
# 2.3 Cloud to cloud
Currently supports some low power Linux、RTOS Equipment of the system. The device side carries out device verification, through the developer's background transfer, and calls the Mini Program in the user's mobile phone WeChat.
Equipment shall meet the following basic requirements:
- HTTPS Communication capability
- Storage capacity
- sound(regard)Frequency capability
# 3. Preparation before development
The following links can be carried out at the same time, involving multiple platform side review processes, please reserve time in advance.
# 3.1 [Only Android devices connected directly] Access to WeChat hardware platform
Registration of WeChat terminal cooperation platform and WeChat open platform account, registration of equipment information and other links involve platform review, please prepare in advance.
reference[file](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/process.html)Guidance, CompleteWeChat terminal cooperation platform (Wecooper)The process of enterprise principal account registration, mobile application binding and hardware registration.
This step is mainly to connect the device to the device system of WeChat, complete the equipment and App, and APP Association with the Mini Program.
- To avoid confusion, the mobile app's appId Generally referred to as hostAppId
- Every piece of hardware needs to be used hostAppId Identity call [addDevice](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/api/backend/addDevice.html) Interface is registered before you can use the Android WMPF。
# 3.2 Equipment Access and Request Equipment
This link involves platform audit, please prepare in advance.
Small programs want to use audio and video calling capabilities, you need to use the Mini Program management platform.Application for openingMini Program audio and video capabilitiesEquipment capacityFor details seeDevice accessDocumentation and[WeChat Mini Program audio and video calls (for Hardware) User manual](https://developers.weixin.qq.com/community/Minihome /doc/0008c27a1c87105df45fcab665b001 )Process guidelines in the[< Hardware VoIP Audit Verification Requirements >](https://developers.weixin.qq.com/community/Minihome /doc/00002e131e8cc8ae8a7f5473f56c01 )。
Upon completion of the access, the developer has access to the model_id。model_id Corresponding to a device type, is an important certificate to call the Mini Programs device capability related interface.
Obtain model_id Later, the developer can call theGet Equipment TicketsInterface acquisition SnTicket, for the subsequentEquipment verificationProcess.
# 3.3 to access VOIP plug-in
The main function of the Mini Program audio and video calls through theVOIP callThis oneMini Program plug-in(appId: Wxf830863afde621eb) provided.
Done in the Mini Program Management backgroundMini Program audio and video capabilitiesApplication and passed, the Mini Program can be used directly VOIP Call plug-in, no additional application required.
If developers want to debug ahead of time, they can do this manually: LoginMini Program management backgroundSet upThird Party SettingsPlugin management, ClickAdd plugin, Search and AddVOIP callPlugins.
# 4. Device Side Development
- The Android device needs to run an Android application provided by the developer for device registration, running a Mini Program for VOIP Call. Please refer to the"Developing Device Side Apps (Android)"
- Linux Integration at the device end Mini Program audio and video call SDK (Linux)
- RTOS Integration at the device end [SDK](https://git.weixin.qq.com /wxa_iot/cloudvoipsdk) Used to make the call.
# 5. Mini Program development
Developers need to develop (or use existing) Mini Programs that accessVOIP callPlug-in, to achieve the ability to make and receive audio and video calls.
- When talking to an Android device, the developer needs to use the same Mini Program, which runs on both the Android device (where the device initiates or receives the call) and the WeChat client on the mobile phone (where the phone user initiates or receives the call).
- and Linux When the device calls, the device side runsMini Program audio and video call SDK (Linux), mobile phone WeChat client running Mini programs (mobile phone users to initiate or receive calls).
- and RTOS When the device calls, the device end of the SDK Used to initiate the call, the server's SDK For the video flow through the process, the mobile phone WeChat client to run a Mini Program (mobile phone users to initiate or receive calls).
# 5.1 Core process
At least use WeChat client 8.0.30 It is recommended to use the latest version.
The development of Mini programs mainly has the following links, please refer to the documents of each link:
- to accessVOIP callPlugins: ReferencePlugin DocumentationIntroducing plug-ins in Mini Programs
- Device to call mobile phone WeChat:
- The user is required toMobile phone WeChatAuthorize the device first, refer to the User Authorization
- Applicable to registered and user authorized device to initiate calls, users in the phone WeChat answer, please refer to"Device call mobile phone WeChat"
- WeChat Calling Device: It is suitable for users to initiate a call in WeChat, and the device has been registered and authorized by the user to answer it, please refer toMobile WeChat Calling Device(Android)》andMobile WeChat Calling Device(Linux)》
- Performance and Experience Optimization: Please refer toPerformance and Experience Optimization。
Call related exceptions, please refer to theCall Anomaly Detection Guide
# 5.2 Debugging instructions
VoIP The call process does not support debugging in WeChat developer tools for the time being, please use the real machine.
# 5.2.1 Device side useDevelopment version/Experience Mini Program
Android devices can be specified to useDevelopment version/Experience Mini ProgramFor debugging. Please refer to the"Developing Device Side Apps (Android)"3.2 Run Development Version/Experience Mini Program。
# 5.2.2 Use the development version/Experience Mini Program to answer the call
After receiving the message push click to answer, the default open is the official version of the Mini Program.
During the development phase, it is recommended that when calling wmpfVoip.initByCaller
When extra incoming miniprogramState
Parameter specifies the opening of the development version/Experience version of the Mini Program.
const result = await wmpfVoip.initByCaller({
// Other parameters omitted
miniprogramState: 'developer', // formal/Official version (default)trial/Experience versiondeveloper/Development version
})
Audio and video calls using Mini Programs SDK (Linux)Can be set at the time of initialization wxa_flavor Specify the use of the development version/The trial version answers the call.
Note:
- If the receiver is WeChat, scan the development version QR code generated by WeChat developer tool to download the development version.
- The receiver is running WMPF Of the equipment, should be in advance in accordance with the 5.2.1 The steps to download the development version.
- The official line should pay attention to switch to the official version, you can use the [
wx.getAccountInfoSync
]((wx.getAccountInfoSync )) Interface determines the current version of the Mini Program.
# 6. Service-side development
RTOS When the device uses a cloud-to-cloud scenario, you need to performService-side development. Device Direct Connect(Linux、Android) No server-side development is required.
# 7. Common problem
Please refer to the Frequently Asked Questions (FAQ)