Skip to content

Embed with one script tag

This is Level 3 of the spec: your site serves the wall itself, on its own route.

<script src="https://diazoma.app/wall/0.1.0/diazoma-embed.js"
integrity="sha384-Hh5ADOoamGSEcffcdXeIIen/jYfC5rHsOJB0CofdWRdrJgkAxZsZN8OrF0SoGy6s"
crossorigin="anonymous"
data-manifest="/.well-known/wall.json"
data-route="/xr"></script>

The files are hosted at https://diazoma.app/wall/0.1.0/ with open CORS, and a version directory never changes, so you can pin the version. The integrity hash checks diazoma-embed.js only. The files it loads next (loader.js, wall.iife.js, and wall-hls.js or wall-dash.js for video) are not hash-checked by the browser. Their SHA-256 hashes are listed in SHA256SUMS in the same directory; to have every file checked, host the files yourself.

The embed script, in this order:

  1. builds a WellKnownAdapter from data-manifest;
  2. stops if the manifest says "policy": "deny";
  3. sets window.diazoma.options with the adapter and the brand (options the page already set win);
  4. creates the mount element if there is none;
  5. injects the wall loader, which loads the core only when it is needed.

Until the wall mounts, window.__diazoma is { version: 'pending', route }. When the wall mounts it replaces it with { version, route, scope, state() }. Other programs, such as a browser extension, check this object and do not add a second wall.

AttributeDefaultMeaning
data-manifestnone, requiredURL of the manifest. Without it the script logs an error and does nothing.
data-routethe path of the current pagePath of the page that shows the wall, such as /xr. Passed on as options.route.
data-corewall.iife.js next to the embed scriptThe wall itself (three.js is bundled in).
data-loaderloader.js next to the embed scriptThe small loader: the Enter VR card, and the lazy load of the core.
data-mount#diazomaCSS selector of the element the wall mounts in.
data-localeenen or bg.
data-title, data-body, data-enter, data-browsebuilt-in textsTexts of the Enter VR card.

Everything is in https://diazoma.app/wall/0.1.0/:

FilePurpose
diazoma-embed.jsThe embed script. This is the tag you add.
wall.iife.jsThe wall itself (three.js is bundled in).
loader.jsThe small loader: the Enter VR card, and the lazy load of the core.
wall-hls.jshls.js, loaded only when an HLS video opens.
wall-dash.jsdash.js, loaded only when a DASH video opens.

There is no latest directory. The ES module build (wall.esm.js) imports three by name, so it is for bundlers and comes with the npm package (being published), not from this directory. Pin a version. The loader is small (at most 3 KB gzipped) and holds no three.js. The core loads only when a visitor enters VR or chooses to browse.

Without wall-hls.js and wall-dash.js next to wall.iife.js, HLS and DASH videos offer “watch in the browser”. mp4 and WebM still play.

To self-host, copy the files into one directory on your site, point src at diazoma-embed.js there, and drop the integrity attribute or compute your own. The source is on GitHub under Apache-2.0.

If you build your own page, use the packages and an adapter directly (npm install @diazoma/wall @diazoma/adapters, once published). See the Wall API and Adapters API.

import { Wall } from '@diazoma/wall';
import { WellKnownAdapter } from '@diazoma/adapters';
const adapter = await new WellKnownAdapter({ origin: location.origin }).ready();
new Wall({ mount: document.getElementById('diazoma'), adapter, brand: adapter.brand }).mount();

Set embed.route in the manifest so other programs can offer to open your wall instead of injecting their own:

"embed": { "route": "/xr" }