Embed API

Embed a playable Frame, a read-only Patch or a node card with an iframe and control it with postMessage.

Status: Release, help-patch and node-card embeds, every view below, the tunetoys-embed/v1 protocol and @tunetoys/embed are implemented; check the release notes for the version that ships them on tune.toys. These docs embed node cards and help patches on every node page.

Subjects and views#

Every embed shows one subject in one view. The server decides which views a subject offers; a view it does not offer falls back to the subject's default with a console warning.

RouteSubjectViews (default first)
https://tune.toys/embed/t/<id>The current public release of a Toyframe; patch and split when the creator allows the Patch
https://tune.toys/embed/r/<digest>One exact release (stable for blog posts and docs)as above
https://tune.toys/embed/help/<type>/<order>A help patch from these docs, by node typesplit, patch, frame, card (with node=<id>)
https://tune.toys/embed/node/<type>One node's card at its default valuescard
ViewShows
frameThe playable Frame with a Play button
patchThe read-only Patch, drawn by the editor: values change, cards fold, ports show hints; nothing is saved or rewired
splitThe Patch above the Frame and Play
cardOne node card, interactive like the editor's but silent; on a help patch, name the node with node=<id>
<iframe
  src="https://tune.toys/embed/help/std.delay/1?view=split&theme=auto"
  title="Your first echo"
  width="560"
  height="480"
  loading="lazy"
  allow="autoplay; midi"
></iframe>

Or let the script build size and upgrade a placeholder: data-tunetoys-embed takes toy:<id>, release:<digest>, help:<type>/<order> or node:<type>.

<div data-tunetoys-embed="node:std.lowpass" data-theme="dark"></div>
<script async src="https://tune.toys/embed/v1/embed.js"></script>

Release embeds follow the creator's embed policy and origin allowlist. Help-patch and node embeds hold no account data and may be framed by any site. A paid release without a demo never shows its Patch.

Query parameters#

All are optional; unknown keys are ignored.

ParameterValuesBehavior
viewframe, patch, split, cardOne of the views the subject offers
nodea node id in the help patchThe card to show with view=card
themelight, dark, autoEmbed chrome and editor theme; not the Toy's Frame theme
controlsshow, hidehide renders the Frame for display plus a Play button
preseta preset id of the releaseApplied after preparation
p.<controlId>numberInitial value of a public control, clamped; at most 32
titleshow, hideTitle line
localea supported localeEmbed chrome language
refopaque labelCounted in daily counters only

There is deliberately no autoplay, no URL loading and no parameter that names an account or entitlement.

Messages#

Messages are plain objects { protocol, channel, id?, type, ... }, at most 16 KiB. Host to embed: init, setParameter, setParameters, play, stop, loadPreset, setTheme, requestState. Embed to host: ready (with subject, view and, for releases, digest), state, parameterChanged, playbackChanged, error, resize. play works only after an in-frame user gesture has unlocked audio; a node card answers not_embeddable. Size the iframe from resize, which follows the handshake as soon as the embed has measured itself. Always check event.origin and event.source before trusting a message; the @tunetoys/embed package does this for you.

Only public control values can be read or written. No message can read source, assets or account data, install, purchase or navigate the top window.

Edit this page on GitHub · Updated 2026-11-01

esc

↑ ↓ move↩ open⌘↩ new tabesc close