How to call recording and play recording in WeChat applet
This time I will show you how to call recording and playback of recording by WeChat applet. What are the precautions for WeChat applet to call recording and playback of recording. The following is a practical case, let’s take a look.
The mini program provides two recording APIs
Old version recording function
First start recording, then stop recording to pull to the temporary address of audio
Start recording:
var that = this; wx.startRecord({ success: function (res) { // 调用了停止录音接口就会触发这个函数,res.tempFilePath为录音文件临时路径 var tempFilePath = res.tempFilePath that.setData({ src: tempFilePath }) }, fail: function (res) { //录音失败的处理函数 } })
Stop recording:
wx.stopRecord()
Play recording:
wx.playVoice({ filePath: src // src可以是录音文件临时路径 })
New version recording
Get the globally unique recording manager, and then all recordings depend on it, and playing the recording requires the internal audio context innerAudioContext Object.
Get the globally unique recording manager:
var that = this; this.recorderManager = wx.getRecorderManager(); this.recorderManager.onError(function(){ // 录音失败的回调处理 }); this.recorderManager.onStop(function(res){ // 停止录音之后,把录取到的音频放在res.tempFilePath that.setData({ src: res.tempFilePath }) console.log(res.tempFilePath ) });
Start recording:
this.recorderManager.start({ format: 'mp3' // 如果录制acc类型音频则改成aac });
End recording:
this.recorderManager.stop()
Play audio:
this.innerAudioContext = wx.createInnerAudioContext(); this.innerAudioContext.onError((res) => { // 播放音频失败的回调 }) this.innerAudioContext.src = this.data.src; // 这里可以是录音的临时路径 this.innerAudioContext.play()
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!
Recommended reading:
The above is the detailed content of How to call recording and play recording in WeChat applet. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



This quick guide will show you how to use AirPlay, Apple's innovative wireless streaming feature to easily share and display content. Allows you to use Wi-Fi to connect your iPhone or iPad to AirPlay-compatible Apple TVs, smart TVs, speakers, and Macs, as well as certain third-party speakers and smart TVs, for seamless data transfer. AirPlay operates on a peer-to-peer basis, connecting your Apple devices through the local network. It uses a combination of technologies, including Real-Time Transport Protocol (RTP) for streaming audio and video and Bonjour for device discovery. Simply put, when you use AirPlay, your device sends a stream of data and then

With the popularity of mobile Internet technology and smartphones, WeChat has become an indispensable application in people's lives. WeChat mini programs allow people to directly use mini programs to solve some simple needs without downloading and installing applications. This article will introduce how to use Python to develop WeChat applet. 1. Preparation Before using Python to develop WeChat applet, you need to install the relevant Python library. It is recommended to use the two libraries wxpy and itchat here. wxpy is a WeChat machine

After making a call, long press to record the screen in the control center and turn on the microphone to record. Applicable model of the tutorial: iPhone13 System: IOS15.3 Analysis 1 First find and click the phone function on the mobile phone desktop. 2 Then dial a number first, then swipe down the screen to bring up the control center. 3 Then long press the screen recording icon in the control center. 4. Then click on the pop-up page to turn on the microphone. 5 Next, after the microphone is turned on, click the Start Recording option. 6. When you see the recording time starting, you can return to the call interface. 7. After the call ends, enter the control center again and click the recording button to stop recording. 8The final phone call recording will be saved in your photo album in the form of screen recording. Supplement: Why iPhone doesn’t have call recording function 1 is crucial

1. First find and click [Recorder] on the desktop of the vivo phone. 2. Click the red recording button in the lower left corner to start recording. 3. After the recording is completed, click the button in the lower right corner to end the recording and save it.

Mini programs can use react. How to use it: 1. Implement a renderer based on "react-reconciler" and generate a DSL; 2. Create a mini program component to parse and render DSL; 3. Install npm and execute the developer Build npm in the tool; 4. Introduce the package into your own page, and then use the API to complete the development.

Implementing card flipping effects in WeChat mini programs In WeChat mini programs, implementing card flipping effects is a common animation effect that can improve user experience and the attractiveness of interface interactions. The following will introduce in detail how to implement the special effect of card flipping in the WeChat applet and provide relevant code examples. First, you need to define two card elements in the page layout file of the mini program, one for displaying the front content and one for displaying the back content. The specific sample code is as follows: <!--index.wxml-->&l

According to news from this site on October 31, on May 27 this year, Ant Group announced the launch of the "Chinese Character Picking Project", and recently ushered in new progress: Alipay launched the "Chinese Character Picking-Uncommon Characters" mini program to collect collections from the society Rare characters supplement the rare character library and provide different input experiences for rare characters to help improve the rare character input method in Alipay. Currently, users can enter the "Uncommon Characters" applet by searching for keywords such as "Chinese character pick-up" and "rare characters". In the mini program, users can submit pictures of rare characters that have not been recognized and entered by the system. After confirmation, Alipay engineers will make additional entries into the font library. This website noticed that users can also experience the latest word-splitting input method in the mini program. This input method is designed for rare words with unclear pronunciation. User dismantling

1. Click to open the dialing interface. 2. Click the three dots on the upper right and click Settings in the pop-up options. 3. Click to automatically record the call. 4. Turn on the automatic call recording function, click on the automatic recording object, and click on the specified number in the pop-up option. 5. Just set the specified number.
