Skip to content

VideoIndicator JSON

roosit edited this page Oct 16, 2026 · 1 revision

VideoIndicator JSON

Up | Code | Русский

Purpose

This page describes the persisted format of the video indicator in a project, a Mixel, and templates. For the user guide to hand-written .vttp, see Video JSON.

Two save modes

The indicator is saved in two modes:

  • toJSON(false) — the real Mixel state: the selected video source, the current property values, and the size and position of the layer.
  • toJSON(true) — a template: property values with no binding to a project, and the layer placement description (maket). VideoSourceProperty.toJSON(true) returns an empty object, so the selected source does not end up in a template.

Common indicator wrapper

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

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

Stable parts:

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

Real mixel state

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

{
  "name": "com.velitask.plagin.official.video",
  "data": {
    "size": { "...": "layer size state" },
    "positionInParent": { "...": "layer position state" },
    "properties": {
      "videoSource": {"sourceId": {"value": 12}},
      "adaptive": {"value": false},
      "fit": {"value": 0},
      "border": {
        "lineColor": {"r": 255, "g": 255, "b": 255, "a": 255},
        "thickness": {},
        "style": {"value": 0},
        "dashPattern": {"value": ""},
        "cornerRadius": {}
      },
      "audioEnabled": {"value": true},
      "volume": {"value": 100}
    }
  }
}

sourceId is the source identifier inside the project; 0 or a missing key means "no source selected".

Template state

A template writes maket instead of size and positionInParent. When a template is exported from the application, the layer is written with a proportional maket (preset: "proportional" with the fractions x, y, w, h); auto can be set by hand: then the placement is taken from the indicator's defineMaket(...) — the bottom right corner, an offset of 50 from the right and the bottom, size 480×270. The source is absent from a template: videoSource is an empty object.

{
  "name": "com.velitask.plagin.official.video",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "videoSource": {},
      "adaptive": {"value": false},
      "fit": {"value": 0},
      "border": {
        "lineColor": {"r": 255, "g": 255, "b": 255, "a": 255},
        "thickness": {},
        "style": {"value": 0},
        "dashPattern": {"value": ""},
        "cornerRadius": {}
      },
      "audioEnabled": {"value": true},
      "volume": {"value": 100}
    }
  }
}

Properties

The row order matches defineProperties().

JSON key Java property SDK type Meaning for the user Default
videoSource mVideo VideoSourceProperty The selected video source. Not selected; {} in a template.
adaptive mAdaptive BooleanProperty Pick the source automatically by the current time. false
fit mFit FitModeProperty How the frame fits into the layer. 0 (COVER)
border mBorder BorderProperty Border around the frame. White, thickness 1, solid, radius 0.
audioEnabled mAudioEnabled BooleanProperty Play the source sound. true
volume mVolume IntegerSliderProperty Volume in percent. 100, range 0..100

videoSource

Key Values Meaning
sourceId.value integer, 0 — not selected Identifier of the video source in the project. Saved only in the real state.

Only sources of the "video" type are allowed. The actual source on a frame is determined as follows: with adaptive = false, it is the saved sourceId; with adaptive = true, it is the project video source whose time interval contains the current time (if there are several, the one that started later wins).

adaptive, audioEnabled

BooleanProperty is saved as {"value": true|false}.

fit

FitModeProperty (EnumArrayProperty<FitMode>) saves the index of the FitMode element as {"value": N}.

value FitMode Behavior
0 COVER Fill the layer keeping the proportions; the excess is cropped.
1 CONTAIN Fit entirely; margins are possible.
2 FILL Stretch to the whole layer without keeping the proportions.
3 NONE Native size, centered.

An index out of range is read as 0.

border

BorderProperty is a composite property: a LineProperty plus a corner radius. Each child key is stored as a separate object.

Key SDK type Format Default Meaning
lineColor ColorProperty {"r","g","b","a"}, each 0..255 white 255,255,255,255 Border color (a is opacity, 255 is opaque).
thickness ThicknessProperty {"value": N} 1 Thickness in pixels, range 0..50; 0 means no border.
style EnumArrayProperty<LineStyle> {"value": N} 0 (SOLID) Line style: 0 SOLID, 1 DASH, 2 DOT, 3 DASH_DOT, 4 DASH_DOT_DOT, 5 LONG_DASH, 6 SHORT_DASH, 7 CUSTOM.
dashPattern StringProperty {"value": "12,6"} "" Dash pattern for CUSTOM.
cornerRadius CornerRadiusProperty {"value": N} 0 Corner radius in pixels, range 0..500.

VideoIndicator.render() uses only lineColor, thickness, and cornerRadius; style and dashPattern are saved and edited but do not affect drawing. The ranges are applied when a value is set from the interface; when JSON is read, the value is not clamped to the range. For thickness and cornerRadius, the default value (1 and 0) is written in a template as an empty object {} (no value key); when loaded, such an object yields the default value. In the real Mixel state, {"value": N} is written after the value has been changed.

The "framed" and "rounded" skins change only lineColor (white), thickness (4 / 0), and cornerRadius (0 / 30).

volume

IntegerSliderProperty saves {"value": N}; 0..100 is allowed, and the resulting volume is N / 100. The property is read in resolveVoice(TickContext) only when audioEnabled = true.

Examples

An adaptive video with a rounded border and reduced sound:

{
  "name": "com.velitask.plagin.official.video",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "videoSource": {},
      "adaptive": {"value": true},
      "fit": {"value": 1},
      "border": {
        "lineColor": {"r": 255, "g": 255, "b": 255, "a": 255},
        "thickness": {"value": 4},
        "style": {"value": 0},
        "dashPattern": {"value": ""},
        "cornerRadius": {"value": 30}
      },
      "audioEnabled": {"value": true},
      "volume": {"value": 40}
    }
  }
}

Compatibility

  • VelitaskPlagin.getUID() (com.velitask.plagin.official) must not be changed without migrating saved projects.
  • Indicator.getName() (video) must not be changed without a migration.
  • Property names (videoSource, adaptive, fit, border, audioEnabled, volume) must not be renamed without a migration: loading goes by name, and renaming is more dangerous than reordering.
  • The names of the child keys of border (lineColor, thickness, style, dashPattern, cornerRadius) are defined by the SDK and must also stay stable.
  • The fit and style indexes are the ordinal numbers of the FitMode and LineStyle constants; the order of the constants must not be changed.
  • Sound is controlled by resolveVoice; the legacy sound fields of VideoSourceProperty itself are not used in the indicator JSON.

Clone this wiki locally