Method SetCurrentAsync
- Namespace
- OBSStudioClient.Model
- Assembly
- OBSClient.dll
SetCurrentAsync(string, CancellationToken)
Makes OBS Studio load a scene collection, and returns when the model shows it completely.
public Task SetCurrentAsync(string name, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the scene collection (Names lists them). The names are case sensitive.
cancellationTokenCancellationTokenA 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 collection and the model has read it (State is Synchronized).
Remarks
OBS Studio answers when it has loaded the collection, which takes longer for a large one, so the call waits for the answer as long as SynchronizationTimeout when that is more than WriteTimeout; and then for the model to read the collection, which takes as long as the first synchronization. What the application holds of the collection that was loaded before (scenes, inputs, scene items) is gone then: ask the model for the new ones. OBS Studio does nothing (and sends no event) when the collection is loaded already, so the call returns at once then.
See SetEnabledAsync(bool, CancellationToken) for the order of changes. Changes that were asked for before this one, and that are not confirmed when OBS Studio changes its collection, end as they do when somebody else changes it.
Exceptions
- ArgumentException
nameis empty.- ObsNotFoundException
OBS Studio has no scene collection 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 loaded the collection.
- 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.