Table of Contents

Getting started

The Huddly .NET SDK consists of a CLI tool and a library designed to facilitate interaction with Huddly devices. This repository provides documentation and code samples demonstrating how to use the Huddly SDK. The SDK supports Linux, macOS, and Windows platforms on both arm64 and x64 architectures.

To get started with the SDK, you first need to install the .NET SDK; at the time of writing, this is version .NET 8.0.

Huddly CLI tool

Available as a dotnet tool, which requires .NET SDK to be installed, or as downloadable binaries. More info here.

Huddly .NET SDK basics

Devices can be interacted with using the IDevice interface. To obtain an IDevice instance, use the Sdk DeviceConnected event or GetMonitoredDevices() method after calling StartMonitoring() on an instance of the Sdk.

Result and Result<T>

Device calls typically return a Result object which traps any potential exceptions raised during the interaction. To determine the outcome of an operation, use the IsSuccess property.

Result result = await device.SetFramingMode(FramingMode.SpeakerFraming);
if (result.IsSuccess)
{
  Console.WriteLine("Framing mode set successfully");
}
else
{
  // When a result is not successful, it contains a message with diagnostic information
  Console.WriteLine($"Could not set framing mode, failed with status code {result.StatusCode} and message {result.Message}");
  // Alternatively, it will also contain an exception that can be used for the same purpose, or to be rethrown.
  Exception error = result.Error;
  _logger.LogError(error, "Could not set framing mode");
}

For operations where a value is included, Result is used. Note that the contained value is safe to use if and only if the Result was successful.

Result<FramingMode> result = await device.GetFramingMode();
if (result.IsSuccess)
{
  // Operation was successful and we can safely retrieve the contained value
  FramingMode currentFramingMode = result.Value;
  Console.WriteLine($"Device is currently using {currentFramingMode}")
}
else
{
  // Handle error
}