今天回复我了吗
今天回复我了吗
  • 发布:2025-05-29 14:06
  • 更新:2025-06-01 20:11
  • 阅读:189

【报Bug】uni-app plus.io.FileReader读取视频文件会直接卡死(40S以上,120M大小)

分类:uni小程序sdk

产品分类: uni小程序SDK

手机系统: iOS

手机系统版本号: iOS 16

手机厂商: 苹果

手机机型: iphone 13 pro, iphone 13 mini

页面类型: vue

SDK版本号: 4.36

示例代码:
plus.io.resolveLocalFileSystemURL(  
              resApp.videoPath,  
              function (entry) {  
                // Toast(`视频读取文件成功10:${JSON.stringify(entry)}`)  
                entry.file(  
                  function (file) {  
                    _this.fileData2 = JSON.stringify(file)  
                    var reader = new plus.io.FileReader()  
                    reader.readAsDataURL(file)  
                    reader.onload = function (e) {  
                      _this.fileData1 = e.target.result  
                      setTimeout(() => {  
                        Toast(`onLoad视频读取文件成功1222:` + _this.fileData1)  
                      }, 3000)  
                    }  
                    reader.onloadend = function (e) {  
                      // uni.showToast({  
                      //   title: '开始进行上传' + e.target.result,  
                      //   icon: 'none',  
                      //   duration: 8000  
                      // })  
                      // console.log('文件内容BASE64:', e.target.result)  
                      // setTimeout(() => {  
                      //   Toast(`文件内容BASE64222::${JSON.stringify(e)}`)  
                      // }, 9000)  
                      // Toast(`文件内容BASE64::${JSON.stringify(e.target.result)}`)  
                      // let str = e.target.result  
                      // let trimmedStr = str.slice(str.indexOf(',') + 1)  
                      // const result = {  
                      //   base64: e.target.result.split(',')[1],  
                      //   size: file.size  
                      // }  

                      // const arrayBuffer = uni.base64ToArrayBuffer(result.base64)  
                      // console.log('arrayBuffer', arrayBuffer)  
                      // setTimeout(() => {  
                      //   Toast(`文件内容BASE64::${arrayBuffer}`)  
                      // }, 1000)  
                      return  
                    }  

                    reader.onerror = function (e) {  
                      // console.log('文件内容BASE64:', e.target.result)  
                      Toast(`readeronerror文件失败::${e.target.result}`)  
                    }  
                  },  
                  function (e) {  
                    Toast(`读取文件出错2:${JSON.stringify(e)}`)  
                    reject(index)  
                  }  
                )  
              },  
              function (e) {  
                Toast(`读取文件出错222`)  
              }  
            )

操作步骤:

选择原生给我的视频文件,然后通过

预期结果:

可以读取bas64进行视频文件路径,然后通过plus.io.resolveLocalFileSystemURL方法进行转成base64进行上传

实际结果:

无法读取,直接崩了

bug描述:

在12promax 可以,在iphone 13 mini 中必现 ,40S以上,120M大小

2025-05-29 14:06 负责人:无 分享
已邀请:
今天回复我了吗

今天回复我了吗 (作者) - uniapp 粉丝条

感觉就是转成base64太大导致的,请问这种有什么方案吗

今天回复我了吗

今天回复我了吗 (作者) - uniapp 粉丝条

顶一手

今天回复我了吗

今天回复我了吗 (作者) - uniapp 粉丝条

有解决方案吗

要回复问题请先登录注册