Table of Contents

Method SetSettingsAsync

Namespace
OBSStudioClient.Model
Assembly
OBSClient.dll

SetSettingsAsync(object, bool, CancellationToken)

Changes the settings of the input, and returns when the model shows it.

public Task SetSettingsAsync(object settings, bool overlay = true, CancellationToken cancellationToken = default)

Parameters

settings object

The settings to change: an object (for example new { text = "Hello" }), a dictionary, or a JsonElement. What the fields are called and what they mean depends on the kind of the input (see Settings).

overlay bool

True to change the settings that are given and leave the others as they are, which is what OBS Studio does with the settings that you change in its properties window; false to take all the settings of the input back to their defaults first, so that the input has the given settings and no others.

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 Settings shows the settings that were given.

Remarks

OBS Studio does not check the settings: it keeps every field that it is given, also one that the kind does not know (and that does nothing), and a value of the wrong kind (a text for a number) makes the input do what it does with a value that it can not use. Look at Settings of an input that is set up as you want, and send what you see there.

A field that is an object is replaced as a whole, not merged (the other fields of the object that was there are gone). A null field is ignored: OBS Studio does not keep a null, so the field keeps what it was. Both were checked with OBS Studio 33.0.0. The input is updated by OBS Studio when it has the settings: a change that the kind of the input can not take (a file that is not there) is not an error of this call. See SetEnabledAsync(bool, CancellationToken) for the order of changes and the wait.

Exceptions

ArgumentException

settings is not an object, or can not be written as JSON.

ObsRemovedException

The input was removed.

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.

ObsNotConfirmedException

OBS Studio made the change, and the model does not show it: the events did not show it in time, and the model could not be read again in time. Do not send the change again.

ObsResponseException

OBS Studio refused the change.