1. Home
  2. Docs
  3. HTTP API of NDI
  4. NDI decoding Preset

NDI decoding Preset

Our NDI decoder has a very practical function: Preset. Preset means you can add the discovered NDI Source to 9 presets represented by 1~9, which is your "Favorites". When you need to quickly select the NDI Source added in Preset for decoding, you only need to specify the Preset ID (1~9).

Preset can bring some additional functional advantages to our NDI decoding devices. For example, we will support an external physical keyboard in the future. Press the 1~9 on the keyboard to complete the rapid switch.

There is also a special preset-0 on the NDI decoder. The meaning of this preset is Blank, used to fill the screen with a customizable color.

Module name: decoder/preset

Basic URL: /api/v1/decoder/preset/

Get current preset list and status


API URL

/api/v1/decoder/preset/status

Request

​ Method: GET/POST

​ Parameters: NONE

Response

Example:

{
    "result": "ok",
    "data": [
        {
            "id": "1",
            "enable": 1, /*or 0*/
            "group": "public",
            "name": "Spark_IO-1916001002 (Channel 1)",
            "device_name": "Spark_IO-1916001002",
            "channel_name": "Channel 1",
            "url": "192.168.100.168:5961",
            "ip": "192.168.100.168",
            "online": "on", /*or "off"*/
            "current": true /*or false*/
        },
        /*...*/
        {
            "id": "0",
            "current": true, /*or false*/
            "color": "#000000"
        }
    ],

    "data_size": 10
}

Data field description:

"data" is a JSON array, "data_size" is a field that help assist to describe "data" array size (you may not use it) .

Each item of the array means one NDI Source discovered in network:

Field Value Description
id [STRING] 1~9 represents normal NDI Source Preset;0 is Blank
enable [INT] 1: This Preset is enabled
0: This Preset doesn’t enable NDI Source; in this case, all subsequent fields are meaningless.
group [STRING] Preset saved group name of NDI Source
name [STRING] Preset saved name of NDI Source
device_name [STRING] Device Name of NDI Source extracted from the name field
channel_name [STRING] Channel Name of NDI Source extracted from the name field
url [STRING] Original URL of NDI Source
ip [STRING] IP address of NDI Source extracted from url field
online [STRING] According to NDI discovery results, it detects the online status of NDI Source defined by this preset:
on: current NDI Source online ( It can be discovered)
off: current NDI Source not online ( It can’t be discovered)

Note: online status is decided by NDI discovery results. It doesn’t mean whether NDI source can be connected and obtain video data. Therefore, it only provides reference significance and cannot be used as a basis for the device to determine online.

current [BOOLEAN] true: The preset is NDI Source of the current decoding
false: The preset is not NDI Source of the current decoding
color [STRING] Only valid for id = "0"
For Preset 0 (Blank),it doesn’t include the following fields enable, group, name, device_name, channel_name, url, ip, online, while return color represents Blank fill color. For detailed formats please refer to 6.4 /api/v1/decoder/preset/set_blank

Add NDI Source to a specified preset


API URL

/api/v1/decoder/preset/add

Request

​ Method: GET/POST

Parameter Value Description
id [STRING], Required Specify preset ID,valid range is 1~9
name [STRING], Required NDI source name,you can get discovery NDI sources list by API /api/v1/decoder/discovery/get and extract name field from them.
url [STRING], Required Original URL of NDI source,you can get discovery NDI sources list by API /api/v1/decoder/discovery/get and extract url field from them.
group [STRING], Optional NDI group name of NDI source. The parameter is optional, If you can get by API /api/v1/decoder/discovery/get and extract group field, it is best to pass in as a parameter.

Note: If the preset ID you specified originally has an NDI source definition, the newly added NDI source will overwrite the old definition.

Response

Example:

{
    "result": "ok"
}

If add successfully, it will return the message of result = "ok". Otherwise, please refer to 1.3 for error message descriptions.

Remove NDI source definition of preset


API URL

/api/v1/decoder/preset/remove

Request

​ Method: GET/POST

Parameter Value Description
id [STRING], Required Specify the preset ID for removing,valid range 1~9

Response

Example:

{
    "result": "ok"
}

If remove successfully, it will return the message of result = "ok", or please refer to 1.3 for error message descriptions.

Define preset 0 (Blank) color


API URL

/api/v1/decoder/preset/set_blank

Request

​ Method: GET/POST

Parameter Value Description
color [STRING], Required Specify the color of preset 0 (Blank). The description format of colors is consistent with the description of colors in HTML, namely:
1. Use RGBA color
2. Start with #, hex to describe R, G, B and A respectively

Common color description types:
#RGB (E.g. #f00 means red)
#RRGGBB (E.g. #ff00ff means purple)
#RRGGBBAA (E.g. #00ff0080 means green, 50% transparency)

Note: The current version doesn’t support Alpha function.

Response

Example:

{
    "result": "ok"
}

If set successfully, it will return the message of result = "ok", or please refer to 1.3 for error message descriptions.

How can we help?