收藏
回答

录音无法启动,之前测试都没有问题,求大神指教

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug wx.getRecorderManager(); 工具 6.5.23 2.0.0

//实现一个计时的录音

blueplay: function () {


var that = this;

var ms = 'modalvoice.m'

var ss = 'modalvoice.s'

that.setData({

time: 1,

[ms]: 0,

[ss]: 0,

})

this.recorderManager = wx.getRecorderManager();


this.recorderManager.onStart(function () {

// 录音开始的回调处理

var interval= setInterval(function () {

var time = that.data.time;

console.log(time)

if (time === 2) {

clearInterval(interval);

}else{

var m = that.data.modalvoice.m

var s = that.data.modalvoice.s

var ms = 'modalvoice.m'

var ss = 'modalvoice.s'

if(s!==60){

console.log(m);

that.setData({

[ms]: m,

[ss]: s+1

})

}else{

that.setData({

[ms]: m+1,

[ss]: 0,

})

}

}

}, 1000);

});

this.recorderManager.onStop(function (res) {

// 停止录音之后,把录取到的音频放在res.tempFilePath

var obj = {

bindtap: "middleplay",

src: '../../image/blue.png',

index: res.tempFilePath

};

that.data.middle.push(obj)


var middle = that.data.middle;

that.setData({

middle: middle

});

var time = that.data.time;

console.log(time)

});

const options = {

sampleRate: 44100,

numberOfChannels: 1,

encodeBitRate: 192000,

format: 'mp3',

frameSize: 50

}

this.recorderManager.start(options);

//modal

var hide = that.data.hidden;

that.setData({

hidden:false

})

},


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

2 个回答

登录 后发表内容