//监听停止录音事件,并把路径保存到数据 这个是nan
this.recorderManager.onStop((res)=> {
APP.commom.uploadFile(res.tempFilePath)
.then(res => {
that.innerAudioContext.src = res;
setTimeout(()=>{
console.log(that.innerAudioContext);
that.time = that.getMinute(that.innerAudioContext.duration);
})
that.innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
});
}).catch(err => {
console.log(err)
});
}
)
//监听停止录音事件,并把路径保存到数据 这个是什么都获取不到
this.recorderManager.onStop((res)=> {
APP.commom.uploadFile(res.tempFilePath)
.then(res => {
that.innerAudioContext.src = res;
that.$nextTick(() => {
that.innerAudioContext.onPlay(()=>{
console.log(that.innerAudioContext);
that.time = that.getMinute(that.innerAudioContext.duration);
})
that.innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
});
})
}).catch(err => {
console.log(err)
});
}
)

- 发布:2021-08-11 15:40
- 更新:2021-08-11 15:40
- 阅读:776
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10 专业版
HBuilderX类型: 正式
HBuilderX版本号: 3.1.13
第三方开发者工具版本号: 1.05.2104092
基础库版本号: 1.05.2104092
项目创建方式: HBuilderX
示例代码:
操作步骤:
http:\/\/kfb021.wx.wygoo.com\/public\/upload\/applet\/20210811\/ec62ac5fdb6ab42d00a10df69116c804.aac
这个是文件位置
http:\/\/kfb021.wx.wygoo.com\/public\/upload\/applet\/20210811\/ec62ac5fdb6ab42d00a10df69116c804.aac
这个是文件位置
预期结果:
可以直接获取到duration不是0也不是nan
可以直接获取到duration不是0也不是nan
实际结果:
使用innerAudioContext api 小程序返回的duration是0或者是nan或者是无限大
使用innerAudioContext api 小程序返回的duration是0或者是nan或者是无限大
bug描述:
录音获取的音频放到音频破防的api里面duration返回的是nan或者是
