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.

channels_enum

Get the list of channels sorted by channel type:

  • 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) )

JSON request example:
request
{
"type": "command",
"to": "gBZX5HEiKGqmIMWR",// manager id (see JSON callback for JSON join in Connection to signaling)
"command": {
"command": "channels_enum",
"type": "all"
}
}
JSON callback example:
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:

Channel states reference:

C# code example:
 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);
        }

devices_enum

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.

JSON request example:
request
{
"type": "command",
"to": "VCLNo00uM7plb9rH", // manager id (see JSON callback for JSON join in Connection to signaling))
"command": {
"command": "devices_enum"
}
}
JSON callback example:
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
]
C# code example:
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); 
            }
        }

mng_props_get

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.

JSON request example:
request
{
"type": "command",
"to": "gBZX5HEiKGqmIMWR",		// manager id
"command": {
"command": "mng_props_get",
"props": [
"remote::location"		// props name
]
}
}
JSON callback example:
callback
[
{
"objectName": "VT_Publisher [hpH4R3SLtsNp5NCT]",
"props": [
{
"remote::location": "US, Chicago" // props value
}
],
"type": "mngProps"
},
null
]
C# code example:
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;
        }

mng_props_set

Set manager properties.

JSON message example:
message
{
"type": "command",
"to": "gBZX5HEiKGqmIMWR",		// manager id
"command": {
"command": "mng_props_set",
"props": "remote::location=\\"US, Chicago\\""		// props name and new value
}
}j
C# code example:
public void SetProps(string name, string value)
        {
            var message = new
            {
                type = "command",
                to = Id,
                command = new
                {
                    command = "mng_props_set",
                    props = $"{name}=\"{value}\"",
                },
            };

            Client.Emit("message", message);
        }

mng_props_remove

Remove manager properties.

JSON message example:
message
{
"type": "command",
"to": "gBZX5HEiKGqmIMWR",		// manager id
"command": {
"command": "mng_props_remove",
"props": [
"test_props"				// props name
]
}
}
C# code example:
public void RemoveProps(string name)
        {
            var message = new
            {
                type = "command",
                to = Id,
                command = new
                {
                    command = "mng_props_remove",
                    props = new string[] { name },
                },
            };

            Client.Emit("message", message);
        }

Last updated