直接上代码
uni.downloadFile({
url: that.playUrl,//文件路径
success: (res) => {
const { statusCode, tempFilePath } = res
if (res.statusCode === 200) {
uni.saveVideoToPhotosAlbum({
filePath: tempFilePath,
success: function (errMsg) {
uni.showToast({
mask: true,
title: '保存成功'
});
},
fail:(errMsg)=>{
uni.showToast({
mask: true,
title: '保存失败'
});
},
complete:(errMsg)=>{
}
});
}
}
});