Skip to content

SubtitlesIndicator JSON

roosit edited this page Oct 16, 2026 · 1 revision

SubtitlesIndicator JSON

Up | Code | Русский

Purpose

This page describes the persisted format of the subtitles indicator in a project, in Mixel, and in templates. For the user guide to manual .vttp editing, see the page Subtitles JSON.

Two save modes

The indicator is saved in two modes:

  • toJSON(false) is the real Mixel state: it contains the selected source/sensor, the current property values, and the layer size and position.
  • toJSON(true) is the template state: it contains maket instead of size and positionInParent; for the sensor property Subtitle, the source/sensor are not fixed (an empty object).

Common indicator wrapper

The layer identifier is built from the plugin uid and the indicator name:

{
  "name": "com.velitask.plagin.official.subtitles",
  "data": {
    "properties": {}
  }
}

Stable parts:

Part Value
plugin uid com.velitask.plagin.official
indicator name subtitles

Real mixel state

In a real Mixel, the layer size and position are stored next to properties. The exact shape of the State fields depends on the current runtime, so an abbreviated structure is shown for them.

{
  "name": "com.velitask.plagin.official.subtitles",
  "data": {
    "size": { "...": "layer size state" },
    "positionInParent": { "...": "layer position state" },
    "properties": {
      "Subtitle": {
        "sourceId": { "value": 5 },
        "sensorId": { "value": 12 }
      },
      "mode": {"value":0},
      "font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
      "highlight": {"r":245,"g":194,"b":66,"a":255},
      "bg": {"color":{"r":0,"g":0,"b":0,"a":255},"transparency":{"value":45}},
      "textAlign": {"value":7},
      "detail": {"value":1}
    }
  }
}

Template state

A template uses maket, and the sensor property stays empty so that the runtime picks the subtitle sensor when the indicator is added to a project.

{
  "name": "com.velitask.plagin.official.subtitles",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "Subtitle": {},
      "mode": {"value":0},
      "font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
      "highlight": {"r":245,"g":194,"b":66,"a":255},
      "bg": {"color":{"r":0,"g":0,"b":0,"a":255},"transparency":{}},
      "textAlign": {"value":7},
      "detail": {"value":1}
    }
  }
}

This is exactly how the runtime writes the numeric field bg.transparency into a template. An empty object {} means the default value 45; to set your own, use {"value": N}.

Properties

JSON key Java property SDK type Meaning for the user Default
Subtitle mSensor SubtitleSensorProperty Subtitle sensor. Empty selection in a template.
mode mMode DisplayModeProperty (EnumArrayProperty<DisplayMode>) How the line is displayed. 0 (BLOCK).
font mFont FontColorProperty Text font and color. Dialog, style 0, size 48, white.
highlight mHighlight ColorProperty Highlight color for karaoke. F5C242 (245,194,66).
bg mBackground TransparentColorProperty Backing under the text. Black, transparency 45.
textAlign mTextAlign TextAlignProperty Text alignment. 7 (BOTTOM_CENTER). 0..8 is allowed.
detail mDetail DetailLevelProperty (EnumArrayProperty<DetailLevel>) Detail level. 1 (STANDARD).

State formats:

  • Subtitle: {"sourceId":{"value":<id>},"sensorId":{"value":<id>}} in the real state, {} in a template.
  • mode: {"value":N}, indexes in the order of DisplayMode: 0 BLOCK, 1 REVEAL_WORDS, 2 REVEAL_CHARS, 3 KARAOKE. An out-of-range index is read as 0.
  • detail: {"value":N}, indexes in the order of DetailLevel: 0 COMPACT, 1 STANDARD, 2 FULL.
  • font: a flat object name, style (0 plain, 1 bold, 2 italic), size (1..999), and color.
  • highlight: a flat color r, g, b, a.
  • bg: a composite property with the children color (a flat color) and transparency ({"value":0..100}; the visibility of the backing is alpha = (100 − transparency) / 100, the color is only r, g, b, its a is not used).
  • textAlign: {"value":0..8} in the order TOP_LEFT, TOP_CENTER, TOP_RIGHT, CENTER_LEFT, CENTER, CENTER_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT.

If a numeric value in the saved state has no value key, the property's default is applied when reading.

Examples

Karaoke with a yellow highlight and no backing:

{
  "name": "com.velitask.plagin.official.subtitles",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "Subtitle": {},
      "mode": {"value":3},
      "font": {"name":"Dialog","style":1,"size":56,"color":{"r":255,"g":255,"b":255,"a":255}},
      "highlight": {"r":255,"g":214,"b":0,"a":255},
      "bg": {"color":{"r":0,"g":0,"b":0,"a":255},"transparency":{"value":100}},
      "textAlign": {"value":7},
      "detail": {"value":0}
    }
  }
}

Here mode.value = 3 turns on karaoke, bg.transparency.value = 100 makes the backing fully transparent (it is not drawn), and detail.value = 0 turns multi-line subtitle lines into a single line.

Compatibility

  • VelitaskPlagin.getUID() (com.velitask.plagin.official) must not be changed without migrating saved projects.
  • Indicator.getName() (subtitles) must not be changed without migration.
  • Property names (Subtitle, mode, font, highlight, bg, textAlign, detail) and the child fields of bg (color, transparency) must not be renamed without migration.
  • The order of the DisplayMode and DetailLevel constants determines the saved indexes: the constants must not be reordered.
  • The order of properties mostly affects the UI, while loading the persisted state goes by names; renaming is more dangerous than reordering.

Clone this wiki locally