Repository navigation
SubtitlesIndicator JSON
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.
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 containsmaketinstead ofsizeandpositionInParent; for the sensor propertySubtitle, the source/sensor are not fixed (an empty object).
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 |
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}
}
}
}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}.
| 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 ofDisplayMode:0BLOCK,1REVEAL_WORDS,2REVEAL_CHARS,3KARAOKE. An out-of-range index is read as0. -
detail:{"value":N}, indexes in the order ofDetailLevel:0COMPACT,1STANDARD,2FULL. -
font: a flat objectname,style(0plain,1bold,2italic),size(1..999), andcolor. -
highlight: a flat colorr,g,b,a. -
bg: a composite property with the childrencolor(a flat color) andtransparency({"value":0..100}; the visibility of the backing isalpha = (100 − transparency) / 100, the color is onlyr,g,b, itsais not used). -
textAlign:{"value":0..8}in the orderTOP_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.
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.
-
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 ofbg(color,transparency) must not be renamed without migration. - The order of the
DisplayModeandDetailLevelconstants 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.