Building Interactivity

Turn tracking + UI into a complete interactive experience: overlays, variables, rules, and scenes.

Overview

Studio is designed so you can author MP4E experiences visually, but everything you create becomes portable MP4E metadata that runs in the player runtime.

The MP4E mental model
MP4E interactivity is built from a few building blocks:

- Layers: organize overlays and control visibility as a group
- Overlays: UI elements on top of the video (fixed or object-bound)
- Plugins: what renders inside an overlay (core plugin, marketplace, or custom HTML/CSS/JS)
- Variables: state (numbers, strings, booleans, timers, lists...)
- Events: "when X happens (only when Y is true), do Z", on the thing it happens to
- Scenes: named time ranges and navigation targets

Layers & Overlays

Use layers to organize “modes” or “segments” of UI (e.g. default UI, premium UI, quiz UI). Overlays live inside layers, and can be fixed on the canvas or bound to tracked objects.

Keep overlays small and composable
Prefer multiple simple overlays over one massive overlay. It makes visibility rules and event actions much easier to reason about.

Overlay size: Auto and Fixed

Every overlay has a size mode, chosen in the Inspector under Position and size → Size Mode:

  • Fit Content (Auto) — the content decides the size. The only size you set is Widest: the width where text wraps. The overlay is as tall as its content and shows only what its plugin draws, so viewers can tap the video right beside it. On the video, the selection box hugs the content and has four corner handles, which change the overlay's Scale (under Transform and visual style) while the opposite corner stays put; there are no side handles.
  • Fixed Size — you set the box: width and height in the Inspector, or eight handles on the video (four corners and four sides). The plugin's content fills the box.

A new overlay starts in Fit Content unless its plugin is made to fill a box. Moving or rotating an overlay never changes its size mode. An overlay that follows a tracked object or a group keeps the eight handles in either mode; resizing it with them switches it to Fixed Size.

Variables

Variables are your state layer. Use them for personalization, gating, counters, timers, branching decisions, and dynamic templates inside plugins.

Variables connect everything
Variables are readable from rules and from plugin templates/scripts, so they’re the easiest way to make UI and logic stay in sync.

Events & Actions

Everything that happens in your video starts with an event — a click on an overlay, an object coming into the picture, a scene starting, a plugin reporting that the viewer answered. You attach actions to an event where the thing lives: on the overlay, the object, its group, the card, the scene or the layer. The project level means “for all of them”. Every level that has actions for an event runs, nearest last; none replaces another.

The event card

Events are shown and edited the same way everywhere, on an event card. It lists the events that have something set, then Add event for the others. Under each event are its entries, in the order they run:

  • Add action opens the action picker: search, the common actions first, then every category and the actions of your installed plugins. Nothing is added until you pick one.
  • An entry can run Only when its conditions hold (an entry without conditions runs every time — “Always”). It can also have a name, and a switch turns it off without deleting it. Add an entry with conditions starts a new one.
  • Entries from other levels that run for the same event are shown greyed, with where they live and Open to go there — for example the project's actions for a plugin's event (“Runs for every overlay of …”), or actions added by Make interactive.
  • An entry that does not run says why (switched off, or another list for the same event is the one that runs). Deleting an entry with actions asks first.
  • Values the event carries are offered as {{eventData.*}} chips, and an event with an object offers the “Object is in group” condition.

Where to find events

  • An overlay: select it → Inspector → Events. Its plugin's events are listed too, and run only for this overlay.
  • An object: select it → Inspector → Events.
  • An object's cards: select the object → Inspector → What viewers see. Each card shows Events of this card and says whom it is for (only this object, every object in a group, every object). Add actions just for this object copies the card onto the object, after asking, so you can give one object actions of its own.
  • An object group: open its settings. The Cards tab sets which card opens on hover, click and so on, with Events of this card under each; the Events tab holds the group's own events, which run for every object in the group, with that object.
  • A scene or a layer: its Events tab (a layer's run when it is switched on or off).
  • The whole project: Project → Events. Playback, input and variable events, actions “for one thing”, one group per plugin, and the events that never run.
Actions list (example)
1// Example: overlay click → set a variable → jump to a scene
2[
3 { "type": "setVariable", "variableId": "choice", "value": "A" },
4 { "type": "goToScene", "sceneId": "scene_path_a" }
5]
Prefer actions over custom code
Actions keep experiences portable and predictable. Use plugin scripts when you need custom UI behavior, then call actions via mp4e.executeActions().

Scenes & Branching

Scenes provide named navigation points. Use scenes for chapters, gated segments, and branching storylines.

Preview Mode (Engine Runtime)

Preview mode runs the engine against your current editor state so rules, variables, layers, overlays, and plugin interactions behave like they will at runtime.

Use the event log while previewing
When preview is enabled, the engine event log shows triggers, evaluations, and executed actions—great for debugging complex logic.

Common Patterns

  • Age gate / paywall: variable-based layer visibility + playback bounds.
  • Chapters: scenes + clickable overlay navigation.
  • Quiz: per-question scenes + loop until answered + branch on selection.
  • Commerce: object group displays + “add to cart” events + custom modal checkout.