Table of Contents

Method SetParameterAsync

Namespace
OBSStudioClient.Model
Assembly
OBSClient.dll

SetParameterAsync(string, string, string?, CancellationToken)

Sets a parameter of the configuration of the profile that is current, or removes it, and returns when OBS Studio has answered.

public Task SetParameterAsync(string category, string name, string? value, CancellationToken cancellationToken = default)

Parameters

category string

The category (the section of the configuration file of the profile): Video, SimpleOutput, AdvOut, Output, ...

name string

The name of the parameter in its category: BaseCX, FilePath, ...

value string

The value, as text; or null to remove the parameter, so that OBS Studio gives it its default again.

cancellationToken CancellationToken

A token that ends the wait. A change that was not sent yet is not sent.

Returns

Task

A task that completes when OBS Studio has answered that it made the change.

Remarks

OBS Studio writes the parameter to the configuration of the profile that is current, and does not check the category, the name or the value: it is meant for the settings that OBS Studio reads itself, and what it does with a value that it does not understand is up to it. A setting that the model has a call for is better changed with the call (SetVideoSettingsAsync((int Width, int Height)?, (int Width, int Height)?, (int Numerator, int Denominator)?, CancellationToken)), which also makes OBS Studio use it. Only the profile that is current can be changed. The model does not keep the parameters, so the call has nothing to wait for but the answer of OBS Studio: ask what it holds with GetParameterAsync(string, string, CancellationToken). See SetEnabledAsync(bool, CancellationToken) for the order of changes.

Exceptions

ArgumentException

category or name is empty.

ObsNotFoundException

The parameter is to be removed and it has no value: there is nothing to remove (Kind is "profile parameter"). Nothing was changed.

ObsNotConnectedException

There is no connection to OBS Studio. Nothing was changed.

ObsNotReadyException

OBS Studio is changing its scene collection, or did so after the call. Nothing was changed.

ObsUnknownOutcomeException

OBS Studio did not answer in time, or the connection ended: it is not known whether it made the change.

ObsResponseException

OBS Studio refused the change.