Table of Contents

Method GetPersistentDataAsync

Namespace
OBSStudioClient.Model
Assembly
OBSClient.dll

GetPersistentDataAsync(ObsDataRealm, string, CancellationToken)

Asks OBS Studio for the data that it keeps for an application in a slot.

public Task<JsonElement?> GetPersistentDataAsync(ObsDataRealm realm, string slotName, CancellationToken cancellationToken = default)

Parameters

realm ObsDataRealm

Where the slot is: for all profiles, or for the profile that is current.

slotName string

The name of the slot.

cancellationToken CancellationToken

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

Returns

Task<JsonElement?>

What the slot holds, as JSON; or null when nothing was put in the slot.

Remarks

OBS Studio keeps the slots for the programs that control it, to hold what they want to remember (a setting, the state of a show): they are in files of OBS Studio, so they stay when OBS Studio closes. The slots of Global are the same for every profile; those of Profile belong to the profile that is current, so a switch to another profile shows other ones. Every program that is connected reads and writes the same slots: pick a name that is yours. The names of the slots are case sensitive.

The slots are not part of the model. See SetEnabledAsync(bool, CancellationToken) for the order of requests.

Exceptions

ArgumentException

slotName is empty.

ArgumentOutOfRangeException

realm is not a realm.

ObsNotConnectedException

There is no connection to OBS Studio.

ObsNotReadyException

OBS Studio is changing its scene collection, or did so after the call.

TimeoutException

OBS Studio did not answer in time (WriteTimeout).