How to implement recording function in uniapp
Uniapp implements the recording function: Use the function [uni.getRecorderManager()] to implement, the code is [methods: {startRecord() {console.log('Start recording'); this.recorderManager].
The operating environment of this tutorial: windows7 system, uni-app2.5.1 version, Dell G3 computer.
How uniapp implements the recording function:
You need to use this paragraph uni.getRecorderManager()
export default { data: { recorderManager: {}, innerAudioContext: {}, }, onLoad(options) { this.recorderManager = uni.getRecorderManager(); this.innerAudioContext = uni.createInnerAudioContext(); // 为了防止苹果手机静音无法播放 uni.setInnerAudioOption({ obeyMuteSwitch: false }) this.innerAudioContext.autoplay = true; console.log("uni.getRecorderManager()",uni.getRecorderManager()) let self = this; this.recorderManager.onStop(function (res) { console.log('recorder stop' + JSON.stringify(res)); self.voicePath = res.tempFilePath; }); }, methods: { startRecord() { console.log('开始录音'); this.recorderManager.start(); }, endRecord() { console.log('录音结束'); this.recorderManager.stop(); }, playVoice() { console.log('播放录音'); console.log('this.voicePath',this.voicePath); if (this.voicePath) { this.innerAudioContext.src = this.voicePath; this.innerAudioContext.play(); } }, } }
The Apple phone cannot be played when the phone is muted
uni.setInnerAudioOption({ obeyMuteSwitch: false })
The recording shown here uses the plug-in luno-audio
,
Recommended (free): uni-app development tutorial
You need to introduce import luchAudio from '@/components/luch-audio/luch-audio.vue' and register (just register in components ) and use
<view class="audioPlay"> <button @tap="startRecord">开始录音</button> <button @tap="endRecord">停止录音</button> <button @tap="playVoice">播放录音</button> </view> <luch-audio v-if="audioContent" :src="audioContent" :play.sync="audioPlayNew" ></luch-audio>
to add it and run it.
Related free learning recommendations: Programming videos
The above is the detailed content of How to implement recording function in uniapp. 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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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



After entering the voice memo, you can record through the red round icon. Tutorial Applicable Model: iPhone13 System: iOS15.3 Analysis 1 First open the phone, find and click Voice Memo. 2After entering the recording page, click the red circular icon to start recording. 3Click the red circular icon again to pause recording. 4Finally click Finish to save. Supplement: Where are the recording files on Apple phones? 1. First open the phone and slide the screen to enter the negative screen. 2After entering voice memo in the top search bar, click the search result. 3After entering the recording page, you can view all recording files. Summary/Notes The recorded part can be played back when recording is paused.

Steps to launch UniApp project preview in WebStorm: Install UniApp Development Tools plugin Connect to device settings WebSocket launch preview

Generally speaking, uni-app is better when complex native functions are needed; MUI is better when simple or highly customized interfaces are needed. In addition, uni-app has: 1. Vue.js/JavaScript support; 2. Rich native components/API; 3. Good ecosystem. The disadvantages are: 1. Performance issues; 2. Difficulty in customizing the interface. MUI has: 1. Material Design support; 2. High flexibility; 3. Extensive component/theme library. The disadvantages are: 1. CSS dependency; 2. Does not provide native components; 3. Small ecosystem.

Users want to use the recording function on their Apple phones, but don't know how to turn on the recording. It's actually very simple. You can find the voice memo button by entering the control center, and click it to enter the phone's recording function. Where is the recording function of Apple's mobile phone? Answer: You can turn on mobile phone recording in the control center. 1. If a user wants to perform mobile phone recording on an Apple mobile phone, he or she needs to turn on the voice memo function in the phone. 2. The fastest way to open a voice memo is to open it in the control center. Click to use it directly. 3. You can also find the voice memo in the software library that comes with the system on the desktop and click to use it. 4. The voice memo function can be uninstalled. If the user accidentally uninstalls the related software, it can be re-downloaded from the app store. 5. If

1. First, find and open Voice Memos on the iPhone desktop and select all recordings. 2. Then, click the red button to start recording the voice memo, and click the red button again to pause the recording.

uniapp development requires the following foundations: front-end technology (HTML, CSS, JavaScript) mobile development knowledge (iOS and Android platforms) Node.js other foundations (version control tools, IDE, mobile development simulator or real machine debugging experience)

UniApp has many conveniences as a cross-platform development framework, but its shortcomings are also obvious: performance is limited by the hybrid development mode, resulting in poor opening speed, page rendering, and interactive response. The ecosystem is imperfect and there are few components and libraries in specific fields, which limits creativity and the realization of complex functions. Compatibility issues on different platforms are prone to style differences and inconsistent API support. The security mechanism of WebView is different from native applications, which may reduce application security. Application releases and updates that support multiple platforms at the same time require multiple compilations and packages, increasing development and maintenance costs.
