Skip to content

Latest commit

 

History

History
48 lines (41 loc) · 1.84 KB

README.md

File metadata and controls

48 lines (41 loc) · 1.84 KB

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