SVF file not loading in Autodesk Forge Viewer 3D

If you are using offline mode, be aware of gzip compression.

Typically, when a server, gives the browser the pf and bin files, these files are gzip compressed, with it’s header containing ‘content-type:gzip’ to specify the file being served is gzip compressed. The browser sees this and natively decodes the file (in C++ land) before handing it off to the javascript engine.

If the ‘content-type:gzip’ header is missing, then the browser doesn’t decompress the file, and it hands the file directly to the javascript engine “as-is” (compressed).

The ‘Forge viewer’ checks for this, and will perform the decompression in ‘javascript-land’ to make up for the mistake. Decompressing in javascript-land ‘hurts performance’ (especially on mobile devices).

Since it looks like you are using local files, like , then try manually decompressing these pf, json and bin files (you need to add a .gz to the end of the file and then unzip each of them). It will result in bigger files, but you won’t get the warning.

Alternatively, and the recommended approach, is to create a local static server (localhost) that sets the ‘content-type:gzip’ header for the compressed files (PF, BIN and json).

Hope this helps

Read more here: Source link