Method TriggerHotkeyAsync
- Namespace
- OBSStudioClient.Model
- Assembly
- OBSClient.dll
TriggerHotkeyAsync(string, CancellationToken)
Triggers a hotkey that this scene or input has (libobs.mute of an input, for example), as if the key was pressed and released, and returns when OBS Studio has answered.
public Task TriggerHotkeyAsync(string name, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the hotkey: one of GetHotkeysAsync(CancellationToken).
cancellationTokenCancellationTokenA token that ends the wait. A change that was not sent yet is not sent.
Returns
- Task
A task that completes when OBS Studio has answered.
Remarks
It is TriggerHotkeyAsync(string, string?, CancellationToken) with the name of this scene or input as the context; the name is the one that it has when the request is made (after the changes that were asked for before it: a rename included). Prefer the method of the model that does the same as the hotkey, when there is one (SetMutedAsync(bool, CancellationToken)).
Exceptions
- ArgumentException
nameis empty.- ObsRemovedException
The scene or input was destroyed.
- 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 triggered the hotkey.
- ObsResponseException
OBS Studio refused the request: this scene or input has no hotkey of that name (ErrorCode is ResourceNotFound).