uniapp下载视频图片并保存到相册

2021-05-31  本文已影响0人  初空

直接上代码

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)=>{
                                    
                    }
                });         
         }
        }
    });
上一篇下一篇

猜你喜欢

热点阅读