小程序端如果不用tempFilePath播放视频 如何将每片的数据组合 然后进行播放 web端解决方案是 const data = new Blob([blob1, blob2, blob3], { type: 'text/plain;charset=UTF-8' }) const src = window.URL.createObjectURL(data)
wx.downloadFile 分片下载后返回的 tempFilePath 不能播放?let download = wx.downloadFile({ url: '../download', header: { Range: `bytes=${0}-${1024 * 1024 * 10}` }, contentType: 'blob', complete: (info) => { console.info('YJDMDownloadFileStreamUrl', info) if (info.statusCode === 206) { this.setData({ ['videoList[' + this.data.activeIndex + '].src']: info.tempFilePath, downloadIng: false }) } }, })
2023-10-26临时解决方案 try catch 包一下 在uni.uploadFile 的 complete回调中做处理 因为我这上传接口是调用成功的 try { uni.uploadFile({ url: ``, filePath: item, name: "file", header: { access_token: token, }, success: (data) => { console.info("-----uploadFilesuccess----", data) }, fail: (err) => { console.info("-----fail----", err) this.Toast("上传图片失败"); }, complete: (data) => { if (data.errMsg === "uploadFile:ok") { const file = JSON.parse(data.data); this.fileList = [file.data]; } console.info("-----complete----", data); } }); } catch (e) { console.info('try catch', e); }
2022-12-06