Method CreateSceneAsync
- Namespace
- OBSStudioClient.Model
- Assembly
- OBSClient.dll
CreateSceneAsync(string, CancellationToken)
Makes a scene, and returns it when the model shows it.
public Task<ObsScene> CreateSceneAsync(string name, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the new scene: it can not be the name of another scene. With OBS Studio that has obs-websocket 5.6 or older it can not be the name of an input either. The names are case sensitive.
cancellationTokenCancellationTokenA token that ends the wait. A change that was not sent yet is not sent.
Returns
Remarks
The scene is empty. OBS Studio announces a new scene with an event and lists it a moment later (up to about two seconds), and the model shows it as soon as it is complete: the call returns then, so the scene is in Scenes when you get it. See SetEnabledAsync(bool, CancellationToken) for the order of changes and the wait. When the user interface of OBS Studio is busy, its list can be late for much longer (13 seconds were seen on a copy of OBS Studio that had just been started). The model gives up on a scene that the list does not have after 10 seconds, and shows it again when the list has it; a call that ends before that says ObsNotConfirmedException.
Exceptions
- ArgumentException
nameis empty.- ObsNameInUseException
The name is taken (by a scene, or by an input with obs-websocket 5.6 and older). 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 scene.
- ObsNotConfirmedException
OBS Studio made the scene, and the model does not show it. Do not send the change again.
- ObsResponseException
OBS Studio refused the change.