Managers
This article contains manager commands reference
A manager is an instance of VT_Publisher.exe or VT_Receiver.exe running at a given location. And VT_Server.exe instance acts both as publisher and receiver.
To keep an actual list of managers you need to handle the following events:
on_join
on_leave
on_props_set
Below is the list of commands available for manager instances.
- all - get all channels (Publisher: SOURCES panel, Receiver: selector for STREAM TO)
- ready - get channels that are ready to publish (Publisher: SOURCES panel)
- output - get channels that have at least one connected client (Publisher: OUT panel, Receiver: IN panel) )
callback
[
{
"channels": [
{
"channelState": 0,
"channelType": 5,
"location": ""US, Chicago"",
"name": "Screen:ASUS TUF Gaming VG279QL1A"
},
{
"channelState": 0,
"channelType": 2,
"location": "US, Chicago",
"name": "B525 HD Webcam"
},
{
"channelId": "mp://mplaylist _ML_UID:{42CE8DCF-14EC-00DA-9625-91768E3ED46E}",
"channelPeerID": "QYQyE97bDbAhRfmO",
"channelState": 3,
"channelStatus": "(Web20:0) Ready for connect VT20 GW:3 W:0 C:0 ",
"channelType": 3,
"location": "US, Boston",
"name": "mp://mplaylist",
"previewURL": "[<https://vt08.medialooks.com:8080/CDqjLuf4CFw1keW+>]"
{
"channelState": 0,
"channelType": 6,
"location": "US, Chicago",
"name": "Microphone (B525 HD Webcam)"
},
{
"channelState": 0,
"channelType": 6,
"location": "US, Chicago",
"name": "PC Sounds (Loopback)"
}
],
"location": "US, Chicago",
"objectName": "VT_Publisher [hpH4R3SLtsNp5NCT]",
"type": "channels"
},
null
]
Channel types reference:
Value | Type |
---|---|
0 | None |
1 | NDI |
2 | SDI |
3 | MP_Link |
4 | URL |
5 | Screen Capture |
6 | Audio |
7 | Mixer |
Channel states reference:
Value | State |
---|---|
0 | Closed |
1 | Preview |
2 | Output |
3 | Preview_Output |
4 | Mixstream |
5 | Preview_mix |
6 | Output_Mix |
7 | Preview_Output_Mix |
16 | Disconnected |
public void EnumerateChannels()
{
var request = new
{
type = "command",
to = Id,
command = new
{
command = "channels_enum",
type = "all",
},
};
Action<SocketIOResponse> callback = (response) =>
{
Console.WriteLine($"<-- response: {response}");
try
{
var channels = response.GetValue(0)
.GetProperty("channels")
.Deserialize<Channel[]>();
if (channels != null)
{
Channels.Clear();
foreach (var channel in channels.OrderBy(c => c.Location).ThenBy(c => c.Name))
{
channel.Client = Client;
channel.Manager = this;
Channels.Add(channel);
}
}
}
catch (Exception e)
{
Console.WriteLine($"exception: {e.Message}");
}
};
Client.Emit("request", request, callback);
}
Get the list of available output devices. This command suits only the Receiver manager since Publisher doesn’t have any output besides streaming to other modules.
callback
[
{
"devices": [
{
"busy": false,
"name": "A: Default Audio Device (WASAPI)",
"type": "SDI"
},
{
"busy": false,
"name": "A: Realtek Digital Output (Realtek(R) Audio) (WASAPI)",
"type": "Audio"
},
{
"busy": false,
"name": "A: Realtek ASIO (ASIO)",
"type": "Audio"
}
],
"objectName": "VT_Receiver [hpH4R3SLtsNp5NCT]",
"type": "devices"
},
null
]
public void EnumerateDevices()
{
if (Name == "_VT_MNG_RCV_") // publisher has no use for outpuit devices
{
var request = new
{
type = "command",
to = Id,
command = new
{
command = "devices_enum",
},
};
Devices.Clear();
Devices.Add(new Device() { Name = "NDI" });
Devices.Add(new Device() { Name = "Virtual" });
Action<SocketIOResponse> callback = (response) =>
{
Console.WriteLine($"<-- response: {response}");
try
{
var devices = response.GetValue(0)
.GetProperty("devices")
.Deserialize<Device[]>();
if (devices != null)
{
foreach (var device in devices.OrderBy(d => d.Name))
{
Devices.Add(device);
}
}
}
catch (Exception e)
{
Console.WriteLine($"exception: {e.Message}");
}
};
Client.Emit("request", request, callback);
}
}
Get manager properties. The properties could be specified via
"props_name"
, "node::props_name"
or "node"
(for node attributes list returned). You can read the properties list here.public async Task<string> GetProps(string name)
{
var request = new
{
type = "command",
to = Id,
command = new
{
command = "mng_props_get",
props = new string[] { name },
},
};
string value = null;
Action<SocketIOResponse> callback = (response) =>
{
Console.WriteLine($"<-- response: {response}");
try
{
value = response.GetValue(0)
.GetProperty("props")
.EnumerateArray()
.Select(i => i.EnumerateObject().FirstOrDefault())
.First()
.Value
.ToString();
}
catch (Exception e)
{
Console.WriteLine($"exception: {e.Message}");
}
};
Client.Emit("request", request, callback);
await Task.Delay(500);
return value;
}
Set manager properties.
Remove manager properties.
Last modified 1yr ago