RecorderManager.onStop在手机上面小程序是正常的,但是在平板 ipad上面无法结束录音。
这个方法,点击打印有这个方法:
但是代码里面就是进不去
<template>
<view class="content">
<view>
<button @tap="startRecord">开始录音</button>
<button @tap="endRecord">停止录音</button>
<button @tap="playVoice">播放录音</button>
</view>
</view>
</template>
<script>
const recorderManager = uni.getRecorderManager();
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
export default {
components: {
},
data() {
return {
voicePath: ''
};
},
onLoad(options) {
let self = this;
recorderManager.onStop(function (res) {
console.log('进来onStop');
console.log('recorder stop' + JSON.stringify(res));
self.voicePath = res.tempFilePath;
});
},
onShow() {
},
onReady() {
},
methods: {
startRecord() {
console.log('开始录音');
recorderManager.start();
},
endRecord() {
console.log('录音结束');
recorderManager.stop();
},
playVoice() {
console.log('播放录音', this.voicePath);
if (this.voicePath) {
innerAudioContext.src = this.voicePath;
innerAudioContext.play();
}
}
},
};
</script>
<style lang="scss" scoped>
</style>
你好,请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。