| 框架类型
| 问题类型
| 操作系统
| 工具版本
|
|---|
| 小程序
| Bug
| macOS
| 1.02.1809111
|
按住录音
startRecode: function () {
const options = {
duration: 10000,//指定录音的时长,单位 ms
sampleRate: 16000,//采样率
numberOfChannels: 1,//录音通道数
encodeBitRate: 96000,//编码码率
format: 'mp3',
frameSize: 50,//指定帧大小,单位 KB
}
recorderManager.start(options);
},
endRecode:function() {
recorderManager.stop();
var s = this;
recorderManager.onStop((res) => {
let audioFilePath = res.tempFilePath
console.log(res)
console.log(audioFilePath)
setTimeout(function(){
wx.uploadFile({
url: config.service.uploadUrl,
filePath: audioFilePath,
header: {
miniProgram: "ios"
},
name: 'file',
success: function (res) {
var data = res.data;
console.log(res);
if (data.states == 1) {
var cEditData = s.data.editData;
cEditData.recodeIdentity = data.identitys;
s.setData({ editData: cEditData });
}
else {
wx.showModal({
title: '提示',
content: data.message,
showCancel: false,
success: function (res) {
}
});
}
wx.hideToast();
},
fail: function (res) {
console.log(res);
wx.showModal({
title: '提示',
content: "网络请求失败,请确保网络是否正常",
showCancel: false,
success: function (res) {
}
});
wx.hideToast();
}
});
},2000)
})
},
最后会报"Cannot read property 'mime' of null"这个错误 请问这是为何啊