Table of Contents

Method SeekAsync

Namespace
OBSStudioClient.Model
Assembly
OBSClient.dll

SeekAsync(TimeSpan, CancellationToken)

Moves the media to a position, and returns when OBS Studio has answered.

public Task SeekAsync(TimeSpan position, CancellationToken cancellationToken = default)

Parameters

position TimeSpan

The position, from the beginning of the media, in whole milliseconds (a part of a millisecond is rounded). OBS Studio does not check it against the length: a position beyond the end ends the media.

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 OBS Studio has answered.

Remarks

The position is not in the model, so there is nothing to wait for: ask GetStatusAsync(CancellationToken) where the media is. What OBS Studio does with it (measured with OBS Studio 33.0.0): a media that plays and is shown goes to the position and plays on from there, and a position beyond the end ends the media (Ended). A media that is not shown takes the change and does not move, and one that is paused takes it and then says position zero and plays from the start (the position of a paused media is not kept). See SetEnabledAsync(bool, CancellationToken) for the order of changes.

Exceptions

ArgumentOutOfRangeException

position is negative, or more than about 24 days.

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.

ObsResponseException

OBS Studio refused the change: the media neither plays nor is paused (ErrorCode is InvalidResourceState).