Method RemoveAsync
- Namespace
- OBSStudioClient.Model
- Assembly
- OBSClient.dll
RemoveAsync(CancellationToken)
Removes the input, and the scene items that show it, and returns when the model shows it.
public Task RemoveAsync(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 the input is removed (State is not Live) and the scene items that were showing it are gone.
Remarks
OBS Studio keeps an input alive after it is removed for as long as scene items show it: the input is not in Inputs then (it is Detached), its scene items stay in their scenes and keep working, and its name stays taken. This call removes the input and then the scene items that show it, one request after the other, so that OBS Studio destroys it (Gone) and the name is free. Calling it on an input that is Detached removes the scene items that are left. When OBS Studio refuses one of the scene items (it was removed meanwhile: by the user, or by OBS Studio itself, which takes the scene items of a removed input out of the scenes that it is rendering on the next frame, so a scene item can be gone between two requests of this call), the call ends with the exception once the model shows what the requests before it made (the input is Detached, and the scene items that were removed are gone), so that calling RemoveAsync(CancellationToken) again removes what is left. An input that a scene item shows that the model did not know yet (OBS Studio announces it a few milliseconds late) stays Detached in the same way.
The scene items are the ones that the model shows when the change has its turn (see GetSceneItems()). See SetEnabledAsync(bool, CancellationToken) for the order of changes and the wait.
Exceptions
- InvalidOperationException
A scene item in a group shows the input: obs-websocket removes the scene items of scenes only, not those of a group, so the input can not be removed for good from here (take it out of the group in OBS Studio first). Nothing was changed.
- ObsRemovedException
The input does not exist any more.
- 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. Do not send the change again.
- ObsResponseException
OBS Studio refused the change.