小程序上传视频超过一定大小,上传过程中闪退 (cos.putObject),使用开发工具上传正常。

发布于 8 年前作者 zhuguiying6292 次浏览最后编辑 8 年前来自 ask

如题

2 回复
aye
aye1 楼6 年前

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

jiezhang
jiezhang2 楼6 年前
cos.postObject({
        Bucket: --,
        Region: --,
        Key: fileKey,
        FilePath: filePath,
        onProgress: function (info) {
          let oldP = _this.data.percent1;
          let percent = Math.floor(info.percent*100);
          let loaded = info.loaded;
          console.log(oldP + ":" + percent + "->" + info.loaded + ": " + info.total)
          if(oldP != percent){
            _this.setData({
              percent1: info.percent * 100
            })
          }
        }
      }, function (err, data) {
//...
}