根据官方示例写的,
onLoad() {
let self = this;
recorderManager.onStop(function (res) {
console.log('recorder stop' + JSON.stringify(res));
self.voicePath = res.tempFilePath;
});
},
methods: {
startRecord() {
console.log('开始录音');
recorderManager.start();
},
endRecord() {
console.log('录音结束');
recorderManager.stop();
},
playVoice() {
console.log('播放录音');
if (this.voicePath) {
innerAudioContext.src = this.voicePath;
innerAudioContext.play();
}
}
}
打印出来recorderManager是空的,主要是录音结束之后onStop方法没触发,按说不是自动触发的吗
1 个回复
2***@qq.com (作者)
我看有其他人也问过,后面都没有讲是为什么,怎么解决的