Embed with one script tag
This is Level 3 of the spec: your site serves the wall itself, on its own route.
The tag
Section titled “The tag”<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:
- builds a
WellKnownAdapterfromdata-manifest; - stops if the manifest says
"policy": "deny"; - sets
window.diazoma.optionswith the adapter and the brand (options the page already set win); - creates the mount element if there is none;
- 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.
Attributes
Section titled “Attributes”| Attribute | Default | Meaning |
|---|---|---|
data-manifest | none, required | URL of the manifest. Without it the script logs an error and does nothing. |
data-route | the path of the current page | Path of the page that shows the wall, such as /xr. Passed on as options.route. |
data-core | wall.iife.js next to the embed script | The wall itself (three.js is bundled in). |
data-loader | loader.js next to the embed script | The small loader: the Enter VR card, and the lazy load of the core. |
data-mount | #diazoma | CSS selector of the element the wall mounts in. |
data-locale | en | en or bg. |
data-title, data-body, data-enter, data-browse | built-in texts | Texts of the Enter VR card. |
Files and versions
Section titled “Files and versions”Everything is in https://diazoma.app/wall/0.1.0/:
| File | Purpose |
|---|---|
diazoma-embed.js | The embed script. This is the tag you add. |
wall.iife.js | The wall itself (three.js is bundled in). |
loader.js | The small loader: the Enter VR card, and the lazy load of the core. |
wall-hls.js | hls.js, loaded only when an HLS video opens. |
wall-dash.js | dash.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.
Use the packages instead
Section titled “Use the packages instead”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();Advertise the route
Section titled “Advertise the route”Set embed.route in the manifest so other programs can offer to open your wall instead of
injecting their own:
"embed": { "route": "/xr" }