Module name: decoder/discovery
Basic URL: /api/v1/decoder/discovery/
Note: : APIs of this module is only effective when the device works in Decoder mode.
文章目录
Get NDI Sources discovered in network
API URL
/api/v1/decoder/discovery/get
Request
Method: GET/POST
Parameter | Value | Description |
---|---|---|
force | [ANY], Optional | If you specify force parameter, no matter what it is, it requires NDI Device to force a rescan of the network. |
Response
Example:
{
"result": "ok",
"data": [
{
"group": "public",
"name": "Spark_IO-1916001002 (Channel 1)",
"device_name": "Spark_IO-1916001002",
"channel_name": "Channel 1",
"url": "192.168.100.168:5961"
},
/* ... Each discovered items in the array ... */
],
"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 |
---|---|---|
group | [STRING] | NDI Source located NDI Group. If the Group you get is a empty string "", it means public group by default. |
name | [STRING] | NDI Source Name. It is original name for NDI Source. If you want to get device name, channel name, please refer to device_name and channel_name. |
device_name | [STRING] | NDI Device Name resolved from name,which normally represent host name of NDI Source. |
NDI Channel Name resolved from name | ||
url | [STRING] | NDI Source URL. Note: Current URL format is <IP>:<port> ,but it is recommended to not take it as the fact, NDI SDK does not guarantee this. Please keep the url original value and don’t attempt to change it while using. |
TIPS:
A. NDI Discovery based on mDNS mechanism, which can only discover NDI Sources that in the same subnetwork with current NDI Device by default.
B. Considering there a huge lot of NDI Sources in your network, and NDI Discovery speed is not as fast as you imagine, so NDI Device will cache the sources discovered previously and return the results to you as soon as possible. In the same time, NDI Device will keep scanning and update cache in the background. Therefor, the result you get may not be completely up-to-date (but in most cases). You can get updates by calling this API periodically.
Manual discovery: specify IP and/or NDI Groups
In most cases, we can discover automatically NDI Sources via network, but there some special conditions:
- NDI auto discovery can’t discover NDI Sources not in the same Subnet;
- NDI has its own logical group, by default, NDI auto discovery can only discover devices of group "public";
- Other conditions that due to network restricted network Multicast.
Under above conditions, we may need to manually specify target IP address and/or NDI Groups of NDI discovery.
API URL
/api/v1/decoder/discovery/set_manual_targets
Request
Method: POST ( Please note
This API can only use POST method and submitted parameters need to use JSON format)
Parameters (example):
{
"ip": ["192.168.100.3", "172.16.10.5" /*, ...*/],
"group_name": ["public", "private_group", "my-group" /*,...*/]
}
Parameter | Value | Description |
---|---|---|
ip | [ARRAY(STRING)] , Optional | Through JSON array, specifying one or more target IP addresses of NDI Sources that NDI Sources manually discovered. Specified IP address can be in different Subnet with current NDI Device. This parameter is optional. If not specify, the former specified manual IPs will be cleared. |
group_name | [ARRAY(STRING)] , Optional | Group Names. Through JSON array, specifying one or more NDI Group Names that NDI Sources manually discovered This parameter is optional. If not specified, the former specified Group Name will be cleared. |
Note:
A) The IP and NDI Groups that you manually specified will be recorded and saved by the device. Therefore, even if you restart the device, these IP and NDI Groups will work.
B) Manually specifying IP and NDI Groups will not influence it auto discovery. Therefore, you will see all the auto-discovery NDI Sources and manually specified Sources (if target exists).
C) As showed in the parameter description, if you do not specify "ip" or "group_name", it means that it will clear the previous settings. If you need to keep the previous settings, be sure to pass the original value as a parameter. You can get the previous value via API /api/v1/decoder/discovery/get_manual_targets.
Response
Example:
{
"result": "ok"
}
If set successfully, it will return the message of result = "ok". Otherwise, please refer to 1.3 for error message descriptions.
Get specified manual discovery and NDI Groups
API URL
/api/v1/decoder/discovery/get_manual_targets
Request
Method: GET/POST
Parameter: NONE
Response
Example:
{
"result": "ok",
"data": {
"ip": ["192.168.100.3", "172.16.10.5" /*, ...*/],
"group_name": ["public", "private_group", "my-group" /*,...*/]
}
}
Data field description:
Field | Value | Description |
---|---|---|
ip | [ARRAY(STRING)] | Return a list of all manually specified IP addresses through the array. |
group_name | [ARRAY(STRING)] | Return a list of all manually specified NDI Groups through the array. |