Anyone with some insight into why and when "lengthComputable" is true or false?

hi all

Any idea about what makes this true or false , well mostly. I understand it could be many things perhaps.

I saw it was false on a local project , then thought well when its on a server then perhaps it will be fine… but even there it is false?

Is there ssome sort of mime type set up the server needs to be able to give progress events ( ive had something like that before back in the days of flash )

any info would be appreciated

It would usually mean Content-Length is not set on the response header by the server. Maybe you could share a repro so we can try to check ? but in general I d try to head over to the forum of the server you are using for those as the answers might be fully different depending on the server type.

Thanks @sebavan , i just get things to a demo stage for client again beore adding new content , one last thing to add in today for that and another round of cross platform , cross device testing and then I can add you to the repo , its a private repo , but if I add you then you can view and pull etc.

I will share the demo link as well ,

I will also point out where it is in the code that im doing the preloading so you dont have to dig , I did look at the headers coming from the server and I do see content length ( response headers ) so its not that , I also made sure im not doing something stupid and I cant see any fault, i mean its a property of the progress event , im just reading it from there ( and setting it to a local variable of the containing class , which the preloader store is reading. ).

I will come back here with the demo link as soon as im done and then also share repo with you.

EDIT POST: Ok , after posting heaps of code here … I then saw something wrong … haha so im deleting it… will report back again

all good in the hood , lets pretend this never happened , it was the most stupid mistake I overlooked in the loading pipeline , I was only setting my local variable of lengthComputabe within the else of the condition that checks the value of lengthComputabe of the progress event payload … meaning it can only ever be set to false … doh… dont ask me how i managed to do something that smart… special skills haha :wink:

In case you see this again, lengthComputable is often false when the content is compressed. This often is the case for text content such as glTF files.

thanks for the heads up , i use glb , which is binary , but some assets getted gzipped or that other one .br ( broccoli>?? haha ) by vue … but not all the glb … it must be a webpack setting . anyway good to know

GLB is binary, but it contains the glTF JSON payload. Self-contained GLB may be convenient, but it is not optimal for server scenarios. For server scenarios, it is typically best to serve loose glTF files with external references to geometry bin files and textures or GLB with embedded geometry and loose textures files. The latter can save one request due to the geometry and JSON payload being in one file. For optimal download, the glTF and geometry should be compressed while the textures should not.

ok im ging to look into this now so I can form a good system for my assets and textures that functons in the best manner in all respects. This is very helpful. thanks

1 Like