录音真机测试问题
发布于 5 年前 作者 guiying80 18217 次浏览 来自 问答

   录音调用wx.startRecord()方法,IDE测试没有问题,但是在移动到真机后,无法返回success、fail、complete中的任意一种方法,并且手机也未能收到调用接口方法授权申请,请问是什么问题?



附上代码:

              <button hidden="{{btnIndex!=0}}" type=“primary” bindtap=‘startRecord’ class=“loudspeaker_button”>开始录音</button>

 

    startRecord: function (e) {

        wx.startRecord({

          success: function (res) {

            console.log(“录音成功”);

            var tempFilePath = res.tempFilePath;

          },

          fail: function (res) {

            //录音失败

            console.log(“录音失败”);

          },

          complete:function(res){

            console.log(“录音完成”);

          }

        });

        this.setData({

          btnIndex: this.data.btnIndex + 1

        });

        setTimeout(function () {

          //结束录音  

          console.log(“录音结束”);

          wx.stopRecord();

        }, 1000)

      },

    

回到顶部