/obsclient

A Complete .NET Client for OBS Studio 28 and up.

Primary LanguageC#MIT LicenseMIT

ObsClient

A Complete cross platform .NET WebSocket Client for OBS Studio version 28 and up.
Currently implementing: obs-websocket 5.3.0 Protocol Our intent is to create a complete and easy to use client for OBS Studio.

Installation

Install from the NuGet Gallery
Or through the NuGet CLI: NuGet\Install-Package OBSClient -Version 2.1.1
From the command line: dotnet add package OBSClient --version 2.1.1

Sample usage

Simple

ObsClient client = new();
bool isConnected = await client.ConnectAsync();
if (isConnected)
{
    await client.SetCurrentProgramScene("Gaming Scene");
    Monitor[] monitors = await client.GetMonitorList();
    client.Disconnect();
}
client.Dispose();

Request Batch

ObsClient client = new();
bool isConnected = await client.ConnectAsync(true, "P@ssw0rd", "localhost", 4455, EventSubscriptions.Filters | EventSubscriptions.Scenes);
if (isConnected)
{
    RequestBatchMessage batchRequest = new();
    batchRequest.AddToggleVirtualCamRequest();
    batchRequest.AddSetStudioModeEnabledRequest(true);
    batchRequest.AddSleepRequest(5000, null);
    batchRequest.AddToggleVirtualCamRequest();
    batchRequest.AddSetStudioModeEnabledRequest(false);
    var result = await _client.SendRequestBatchAsync(batchRequest, 6000);
    client.Disconnect();
}
client.Dispose();

Quality Gate Status Build NuGet