收藏
回答

getRecorderManager iOS 真机 onStart、onStop监听不到?

ios手机系统:13.6

ios手机机型:iphone8plus

微信版本号:8.0.18

代码:

const options = {
                    duration: recordDuation,
                    sampleRate: 44100,
                    numberOfChannels: 1,
                    encodeBitRate: 128000,
                    format: 'mp3'
        }
recorderManager.start(options);
recorderManager.onStart(function(res) {
                console.log('recorder onStart' + JSON.stringify(res));
                that.timer = setInterval(() => {
                    console.log('-------')
                    that.tempDuration += 1;
                }, 1000);
            });
recorderManager.onStop(function(res) {
                console.log('recorder stop' + JSON.stringify(res));
                that.pauseAllVioce()
                that.recordStatus = 2
                that.isShow = true
                var currentArrayBuffer = fs.readFileSync(res.tempFilePath);
                console.log('当前:-----------------')
                console.log(currentArrayBuffer)
                console.log('拼接前:-----------------')
                console.log(that.buffers)
                if (that.buffers.length == 0) {
                    that.buffers = currentArrayBuffer
                } else {
                    that.buffers = that.mergeArrayBuffer([that.buffers, currentArrayBuffer])
                }
                that.duration = that.duration + res.duration
                if(res.duration >0) {
                    that.playSourceNewChange = true
                }
                console.log('timer:'+that.timer)
                if (that.timer) {
                    clearInterval(that.timer)
                    that.timer = null
                }
                console.log('timer:'+that.timer)

                that.tempDuration = that.duration / 1000
          
});


回答关注问题邀请回答
收藏

1 个回答

  • Demons
    Demons
    2022-09-22

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2022-09-22
    有用
    回复
登录 后发表内容