ef-captions

Renders caption text synchronized to the timeline.

Caption data format

{
  "segments": [
    { "start": 0, "end": 3.2, "text": "Welcome to Editframe." }
  ],
  "word_segments": [
    { "start": 0,   "end": 0.6, "text": "Welcome" },
    { "start": 0.6, "end": 0.9, "text": "to" },
    { "start": 0.9, "end": 1.8, "text": "Editframe." }
  ]
}

Attributes

AttributeReact propTypeDefaultDescription
captions-scriptcaptionsScriptstring""ID of a `<script type="application/json">` element containing caption data, as an alternative to {@link captionsSrc}.
captions-srccaptionsSrcstring""URL or path to a JSON file with `segments`/`word_segments` caption data.
durationdurationstringHow long this element is active (CSS time, e.g. `"5s"`).
looploopbooleanfalseLoop attribute — when this temporal is a self-driving root under a {@link PlaybackController}, the controller wraps back to `0` instead of pausing at `duration`.
offsetoffsetnumberStart offset (seconds) within a parallel (`fixed`/`contain`/`fit`) parent timegroup.
targettargetstring""ID of the `<ef-video>`/`<ef-audio>` element these captions are timed against.
word-stylewordStylestring""Free-form styling hook (no built-in behavior) — mirrors `@editframe/elements`' `word-style` attribute so consumer CSS/selectors targeting it keep working (e.g. `ef-captions[word-style="highlight"]`).

Events

EventDetailDescription
child-duration-changed{ duration: number }Fires on the nearest context-providing ancestor, when a nested media element's duration becomes known or changes.