端水大师
端水大师
  • 发布:2025-04-30 22:03
  • 更新:2025-05-01 21:16
  • 阅读:297

【报Bug】在renderjs使用fetch请求remoteurl加载超过500M文件,app闪退

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: Windows11 24H2

HBuilderX类型: 正式

HBuilderX版本号: 4.64

手机系统: Android

手机系统版本号: Android 15

手机厂商: 小米

手机机型: 小米14Pro

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

操作步骤:

先下载这个文件到本地

const cachePath = '_doc/project/lix_indoor.las';  
        const task = plus.downloader.createDownload(  
            'http://192.168.31.79:8080/lix_indoor.las',  
            {  
                filename: cachePath  
            },  
            (d, status) => {  
                // 下载完成  
                if (status == 200) {  
                    console.log('Download success: ' + d.filename);  
                } else {  
                    console.log('Download failed: ' + status);  
                }  
            }  
         );  
         task.start();

再把这个文件转成remoteurl

plus.io.resolveLocalFileSystemURL(  
            cachePath,  
            (entry) => {  
                this.fileUrl = entry.toRemoteURL();  
                console.log(this.fileUrl);  
            },  
            (e) => {  
                this.message.alert('Resolve file URL failed: ' + e.message);  
            }  
        );

在renderjs 使用fetch请求这个文件

fetch(this.fileUrl) 

预期结果:

希望fetch正常返回,或者能支持分块加载,

实际结果:

请求失败,app闪退,logcat报错内存溢出

bug描述:

使用api将文件转成RemoteURL,给renderjs访问 文件大小500MB , app闪退,我的目的是需要在threejs显示这个文件,所以需要在renderjs显示本地文件,只能转成remoteurl, 如果使用file://开头的地址,无法访问,如果我是通过http请求服务器访问这个文件,app能正常执行, plus.io.FileReader也不支持readAsArrayBuffer

2025-04-30 22:03 负责人:无 分享
已邀请:
风之源

风之源 - 我这么闲给你评论,是因为我的问题还没有人回答~

有没有可能是内存爆了

  • 端水大师 (作者)

    内存肯定爆了,但是这就是个bug,http返回文件,不需要一次分配这么多内存,我自己已经写了一个原生http插件,解决了这个问题,官网这个就是大文件不行

    2025-05-04 12:55

要回复问题请先登录注册