Table of Contents

Method SetCurrentAsync

Namespace
OBSStudioClient.Model
Assembly
OBSClient.dll

SetCurrentAsync(string, CancellationToken)

Makes a profile the current one, and returns when the model shows it.

public Task SetCurrentAsync(string name, CancellationToken cancellationToken = default)

Parameters

name string

The name of the profile (Names lists them). The names are case sensitive.

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 Current is the profile.

Remarks

OBS Studio does nothing (and sends no event) when the profile is the current one already, so the call returns at once then. The video settings, the stream service and the folder for recordings are those of the profile that is current now: ask for them again. See SetEnabledAsync(bool, CancellationToken) for the order of changes and the wait.

Exceptions

ArgumentException

name is empty.

ObsNotFoundException

OBS Studio has no profile of that name (the message suggests names that are close). 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.

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.