a_靖通过本文主要向大家介绍了微信小程序录音,微信小程序语音播放等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
//test.wxml
<button bindtap='start'>开始录音</button>
<button bindtap='play'>播放录音</button>
<button bindtap='stop'>停止录音</button>
//test.js
var voice = "";
Page({
play: function () {
//播放声音文件
wx.playVoice({
filePath: voice
})
},
start: function () {
//开始录音
wx.startRecord({
success: function (e) {
voice = e.tempFilePath
}
})
},
stop: function () {
//结束录音
wx.stopRecord();
}
})
以上就是为大家整理的微信小程序录音与微信小程序语音播放功能的实现代码