使用 recorderManager 在Android机上面没问题,可以正常录音播放,
在ios无法录音;
在开发者环境上也是可以的
我也遇到了相同的问题。目测, recorderManager.start(parse); 根本就没有启动成功,所以没有触发onstop,和onstart事件。
andriod,和开发者环境上都没有问题,在iPhone上才有问题,我的是7 plus
机型: iphone6 plus 微信版本6.5.22
appid: wxce452b009d838629
代码:
const recorderManager = wx.getRecorderManager();// 录音管理
recorderStart: function(){
var that = this;
const parse = {
duration: 600000,
sampleRate: 24000,
numberOfChannels: 1,
encodeBitRate: 128000,
format: ‘aac’,
frameSize: 5,
}
recorderManager.start(parse);
recorderManager.onStart(() => {
console.log(‘recorder start’)
})
that.recorderJishi();
},
recorderPause: function(e){
recorderManager.pause()
},
recorderResume: function(e){
recorderManager.resume()
},
recorderStop: function(e){
var that = this;
recorderManager.stop();
recorderManager.onStop((res) => {
console.log(‘recorder stop’, res)
var action = that.data.action;
action.audio_path = res.tempFilePath;
action.time = parseInt(res.duration/1000);//录音时长
action.min = parseInt(action.time/60);
action.second = parseInt(action.time%60);
action.recording = 0;
action.recorder_sure = 1;
})
},