Method SwitchToAsync
- Namespace
- OBSStudioClient.Model
- Assembly
- OBSClient.dll
SwitchToAsync(CancellationToken)
Makes the scene the program scene (the one that is on the air), and returns when the model shows it.
public Task SwitchToAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token that ends the wait. A change that was not sent yet is not sent.
Returns
- Task
A task that completes when IsProgram is true, or when the model has been read again after the events did not show it.
Remarks
OBS Studio shows the scene through the transition that is set, and announces the new program scene when the transition has ended, which can take longer than ConfirmationTimeout. It answers a question about the program scene with the new scene at once, so the model reads it, and the task completes while the transition is still running. See SetEnabledAsync(bool, CancellationToken) for the order of changes and the wait.
Exceptions
- InvalidOperationException
The scene is a group (IsGroup): a group is not a scene that can be on the air.
- ObsRemovedException
The scene 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.