Table of Contents

Method SetIndexAsync

Namespace
OBSStudioClient.Model
Assembly
OBSClient.dll

SetIndexAsync(int, CancellationToken)

Moves the scene item to a position in its scene, and returns when the model shows it.

public Task SetIndexAsync(int index, CancellationToken cancellationToken = default)

Parameters

index int

The new position: 0 is the bottom, and the number of scene items of the scene minus one is the top.

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 Index is index.

Remarks

The scene items between the old and the new position move by one place, and OBS Studio does not say so item by item: the model reads the scene items again when the events do not show the change in time (see SetEnabledAsync(bool, CancellationToken)).

Exceptions

ArgumentOutOfRangeException

index is negative (thrown at once), or is not a position in the scene (the call ends with it, after the scene item is known to be there: a scene item that was removed is an ObsRemovedException, whatever the position).

ObsRemovedException

The scene item, or its scene, 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.