播放不了已经下载成功的临时文件,Why?
downloadFile : function(){ var that = this; const downloadTask = wx.downloadFile({ url: 'http://mp3.flash127.com/Uploads/201708/20170810_1819_170614.mp3', success: function(res){ wx.playVoice({ filePath: res.tempFilePath, success : function(res){ console.log(res); }, fail : function(){ console.log("Error!"); }, complete : function(){} }); }, fail : function(){ console.log("Error!"); }, complete : function(){} }); downloadTask.onProgressUpdate((res) => { that.setData({ downloadFileProgress: res.progress }); console.log('下载进度', res.progress) console.log('已经下载的数据长度', res.totalBytesWritten) console.log('预期需要下载的数据总长度', res.totalBytesExpectedToWrite) }); //downloadTask.abort();} |
