uni.downloadFile({
// url: JSON.parse(this.circle.videoUrl),
url: this.circle.videoUrl,
success: (res) => {
// 2 成功下载后而且状态码为200时将视频保存到本地系统
if (res.statusCode === 200) {
uni.saveVideoToPhotosAlbum({
filePath: res.tempFilePath,
})
uni.hideLoading();
// 提示用户下载成功
uni.showToast({
title: "下载成功",
icon: "success"
});
}
// 如果该资源不可下载或文件格式出错则提示用户
else {
uni.showToast({
title: "资源格式错误,请联系管理员"
});
}
},
fail: (res) => {
console.log(res);
// 下载失败提醒
uni.hideLoading();
uni.showToast({
title: "下载失败",
icon: "error"
})
}
})

8***@qq.com
- 发布:2023-05-20 11:17
- 更新:2023-05-26 11:00
- 阅读:45
1 个回复
FullStack - 【插件开发】【专治疑难杂症】【解决问题 >50$】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=22130】【骗子请绕道】QQ:543610866
saveVideoToPhotosAlbum 加 fail 回调