Method SetStudioModeEnabledAsync
- Namespace
- OBSStudioClient.Model
- Assembly
- OBSClient.dll
SetStudioModeEnabledAsync(bool, CancellationToken)
Switches studio mode on or off, and returns when the model shows it.
public Task SetStudioModeEnabledAsync(bool enabled, CancellationToken cancellationToken = default)
Parameters
enabledboolTrue to switch studio mode on, false to switch it off.
cancellationTokenCancellationTokenA token that ends the wait. A change that was not sent yet is not sent.
Returns
- Task
A task that completes when IsStudioModeEnabled is
enabled.
Remarks
With studio mode on there is a preview scene (PreviewScene) next to the program scene: OBS Studio makes it the program scene (the scene that is on the air now) when studio mode is switched on, and the model reads it, so PreviewScene follows a moment after IsStudioModeEnabled. OBS Studio sends no event when studio mode is on already.
Do not remove the program scene while studio mode is on: OBS Studio 33.0.0 then stopped answering the requests that need its window for seconds (up to half a minute was seen), and the model reads again until it does. Switch to another scene first. See SetEnabledAsync(bool, CancellationToken) for the order of changes and the wait.
Exceptions
- 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.