ios 11以上版本使用saveVideoToPhotosAlbum方法下载完成后返回闪退?
发布于 7 年前 作者 jxiong 9077 次浏览 来自 官方Issues
saveVideoToPhotosAlbum
saveToPhotosAlbum(tempFilePath) {
  let vm = this;
  thisdownloading = true;
  vm.toast视频后台下载中...'
  wx.downloadFile({
    url: tempFilePath, // 下载资源的地址网络
    success: function (res) {
      // console.log(res)
      // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
      if (res.statusCode === 200) {
        wx.playVoice({
          filePath: res.tempFilePath
        })
      
      // 保存图片到本地
      wx.saveVideoToPhotosAlbum({
        filePath: res.tempFilePath
        success: function (data) {
          // console.log(data);
          vm.downloading = false;
          vm.toast视频下载成功请前往相册查看。
        
        fail: function(res) {
          vm.downloading = false;
          vm.toast视频下载失败,请检查网络
        
      })
    
    fail: function () {
      vm.downloading = false;
      vm.toast视频下载失败,请检查网络
    
  })
1 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部