const downloadTask = wx.downloadFile({
url: 'http://example.com/audio/123',
success (res) {
wx.playVoice({
filePath: res.tempFilePath
})
}
})
downloadTask.onProgressUpdate((res) => {
console.log("aaaa")
console.log('下载进度', res.progress)
console.log('已经下载的数据长度', res.totalBytesWritten)
console.log('预期需要下载的数据总长度', res.totalBytesExpectedToWrite)
})
downloadTask.abort() // 取消下载任务
类似这种,问题是在真机调试的时候没有downloadTask.onProgressUpdate监听不了下载进度变化事件("downloadTask.onProgressUpdate"里面的内容没有被打印出来)
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
https://developers.weixin.qq.com/community/develop/doc/0006680b19c8805bb6f093a8061800?jumpto=comment&commentid=0006c8f6f200d8abbef02d124660