Table of Contents

Method SetMonitorTypeAsync

Namespace
OBSStudioClient.Model
Assembly
OBSClient.dll

SetMonitorTypeAsync(ObsMonitorType, CancellationToken)

Sets whether the audio of the input is also played on the monitoring device, and returns when the model shows it.

public Task SetMonitorTypeAsync(ObsMonitorType type, CancellationToken cancellationToken = default)

Parameters

type ObsMonitorType

What to do with the audio.

cancellationToken CancellationToken

A token that ends the wait. A change that was not sent yet is not sent.

Returns

Task

A task that completes when MonitorType is type, or when the model has been read again after OBS Studio held another type (see the remarks).

Remarks

OBS Studio 33 has no MonitorOnly (see ObsMonitorType): it holds MonitorAndOutput after it was asked for it, so the call returns after the model has been read again (about ConfirmationTimeout), with MonitorType showing what OBS Studio holds, and no exception. Compare MonitorType with what you asked for if that matters. See SetEnabledAsync(bool, CancellationToken) for the order of changes and the wait.

Exceptions

ArgumentOutOfRangeException

type is not a value of ObsMonitorType.

InvalidOperationException

The input has no audio (HasAudio).

ObsRemovedException

The input 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: the computer of OBS Studio has no audio monitoring (ErrorCode is InvalidResourceState).