今天就跟大家聊聊有关使用小程序如何实现录音功能,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
首先判断权限
getPermission: function() { var that = this; wx.getSetting({ success(res) { console.log(res.authSetting) if (res.authSetting["scope.record"] === false) { wx.showModal({ title: '是否录音', content: '是否录音', success: function (tip) { if (tip.confirm) { wx.openSetting({ success: function (data) { if (data.authSetting["scope.record"] === true) { wx.showToast({ title: '授权成功', icon: 'success', duration: 1000 }) that.startLuYin() //授权成功之后,再调用chooseLocation选择地方 } else { wx.showToast({ title: '授权失败', icon: 'success', duration: 1000 }) } } }) } } }) }else{ that.startLuYin() } } }) },