Method StartAsync
- Namespace
- OBSStudioClient.Model
- Assembly
- OBSClient.dll
StartAsync(CancellationToken)
Starts the output, and returns when OBS Studio has begun to start it.
public Task StartAsync(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 model has seen the output start (Status is Starting or a later step), or when the model has been read again after the events did not show it.
Remarks
Starting an output takes time: a stream connects to the streaming service, which can take seconds, and can fail. The call returns when OBS Studio has begun (the output is Starting), not when it runs. Watch Status (or PropertyChanged, or Changed) for Started, and for Stopped again when it could not start. OBS Studio does not always say that a start failed (a recording whose encoder does not start shows an error in its own window and sends nothing more): the status is Starting until the model reads the output, after OutputStepTimeout, and Stopped then.
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. Do not send the change again.
- ObsResponseException
OBS Studio refused the change: the output is running already, or it cannot be started (a stream without a streaming service, a replay buffer that is not enabled).