Method SetSettingsAsync
- Namespace
- OBSStudioClient.Model
- Assembly
- OBSClient.dll
SetSettingsAsync(object, bool, CancellationToken)
Changes the settings of the filter, and returns when OBS Studio has made the change.
public Task SetSettingsAsync(object settings, bool overlay = true, CancellationToken cancellationToken = default)
Parameters
settingsobjectThe settings to change: an object (for example
new { gamma = 0.5 }), a dictionary, or a JsonElement. What the fields are called and what they mean depends on the kind of the filter.overlayboolTrue to change the settings that are given and leave the others as they are; false to take all the settings of the filter back to their defaults first, so that the filter has the given settings and no others.
cancellationTokenCancellationTokenA 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 does not check the settings (see SetSettingsAsync(object, bool, CancellationToken)): it keeps every field that it is given, and a field that is an object replaces the object that was there as a whole. A field that is null is ignored. The change is sent with the name that the filter has when its turn has come, so a rename that you asked for before it does not send it to another filter. See SetEnabledAsync(bool, CancellationToken) for the order of changes.
Nothing in the model shows the settings of a filter, so the call has nothing to wait for but the answer of OBS Studio: ask what it holds with GetSettingsAsync(CancellationToken).
Exceptions
- ArgumentException
settingsis not an object, or can not be written as JSON.- ObsRemovedException
The filter was removed, or its source was destroyed (the filters of a source that OBS Studio removed and keeps alive can still be 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.