收藏
回答

调用了getRecorderManager功能,同时触发打电话makePhoneCall,没有回调?

调用了getRecorderManager功能,同时触发打电话makePhoneCall,IOS有recorderManager.onInterruptionBegin 、 recorderManager.onInterruptionEnd回调,安卓却没有


callMobile() {
        const that =  this
 
        this.record()
 
        wx.makePhoneCall({
            phoneNumber: '19999999999',
            success(res) {
                console.log(11)
 
                 
 
            },
            fail() {
                console.log('fail')
                that.recorderManager && that.recorderManager.stop()
            }
        })
         
    },
 
    initAudio() {
        const that = this
         
        that.recorderManager = wx.getRecorderManager()
 
        that.recorderManager.onError((err) => {
            console.log('error...', err)
            console.log('erro ++ that.recorderManager', that.recorderManager)
            that.recorderManager.stop()
        })
 
        that.recorderManager.onStart(() => {
            console.log('onStart...')
        })
 
        that.recorderManager.onStop(() => {
            console.log('onStop...')
        })
 
        that.recorderManager.onPause(() => {
             
            console.log('onPause...')
        })
 
 
        that.recorderManager.onInterruptionBegin(() => {
            console.log('1录音开始中断了....')
        })
 
        that.recorderManager.onInterruptionEnd(() => {
            console.log('2录音已经恢复成功...')
            that.recorderManager.stop()
        })
    },
 
    record() {
        const that = this
        const options = {
            duration: 600000,
            sampleRate: 16000,
            format: 'mp3'
        }
 
        console.log('that.recorderManager',that.recorderManager)
 
        if(!that.recorderManager){
            that.initAudio()
        }
 
        that.recorderManager.start(options)
    },

IOS可以




安卓却没有onInterruptionBegin\onInterruptionEnd回调


在APP.JS里设置(IOS、安卓)都没有回调效果

wx.onAudioInterruptionEnd(() => {
            console.log('录音已经恢复成功....')
        })
 
        wx.onAudioInterruptionBegin(() => {
            console.log('录音开始中断了....')
        })


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

1 个回答

登录 后发表内容
问题标签