/** * Asset urls an embedder supplies. Shared by the two ways of instantiating the viewer — as * fields of {@link CreateViewerOptions} in a page, and serialised into a generated document by * `renderViewerHtml` — so the two surfaces cannot drift. */ type ViewerAssets = { /** Splat url. May be a `data:` uri, for a document with no sibling files. */ contentUrl: string; /** * Filename describing {@link ViewerAssets.contentUrl}, e.g. `scene.sog`. The splat format * is chosen by the name's extension, so this is required when the url itself has no usable * name — a `data:` uri. */ contentFilename?: string; /** Poster image shown, blurred, while the splat loads. */ posterUrl?: string; /** Equirectangular skybox texture url. */ skyboxUrl?: string; /** Collision data url, for walk mode. A `.glb` is treated as a mesh, otherwise voxels. */ collisionUrl?: string; /** * The gsaf decoder's wasm, fetched only when the content is a `.gsaf` file. Defaults to the * `gsaf-decoder.wasm` shipped beside the viewer's bundle. A document with no sibling files * (an inlined bundle) sets it to the `data:` url the `@playcanvas/supersplat-viewer/gsaf-decoder` * export provides. */ gsafDecoderUrl?: string; /** * The ZSTD decoder's wasm, fetched only when a version 4 `.spz` file loads, on its own or as * a chunk of an `.lcc2` scene. Defaults to the `zstd-decoder.wasm` shipped beside the viewer's * bundle. A document with no sibling files (an inlined bundle) sets it to a `data:` url. */ zstdDecoderUrl?: string; }; /** * Asset urls and settings the embedder supplies to the viewer. The asset urls are the same * fields `createViewer` takes in a page ({@link ViewerAssets}); here every one is optional, * because the document has a default for each. * * Url params on the served page take precedence over every url here, so an embed stays * overridable per instance. Inline {@link ViewerBootstrap.settings} is the exception: it wins * over `?settings=`, so a published experience cannot be repointed at another settings file. * `contentFilename` is ignored when a `?content=` param overrides the url it describes. */ type ViewerBootstrap = Partial & { /** * Experience settings as an object, avoiding a round trip. When omitted the viewer * fetches {@link ViewerBootstrap.settingsUrl}. */ settings?: unknown; /** Where to fetch settings from. Defaults to `./settings.json`. */ settingsUrl?: string; }; /** Options for {@link renderViewerHtml}. */ type RenderViewerHtmlOptions = { /** Asset urls and settings for the viewer to boot with. */ bootstrap?: ViewerBootstrap; /** Value for the document's ``, for a viewer served from a sub-path. */ baseHref?: string; /** * Page background, applied before the first frame renders to avoid a flash. Components * are normalized 0..1, not 0..255, matching `background.color` in the settings format — * so an experience's own colour can be passed straight through. */ backgroundColor?: readonly [number, number, number]; /** Raw markup injected before ``, for analytics or error reporting. */ headExtras?: string; /** * Raw markup injected immediately after ``, for content that must precede the * canvas — a marker element a screenshot pipeline waits on, for example. */ bodyStartExtras?: string; /** Inline the stylesheet into a `