Class PlayOptions
Options of a playback request issued through PlayAsync(Track, PlayOptions?, CancellationToken) or PlayIdentifierAsync(string, PlayOptions?, CancellationToken).
public sealed record PlayOptions : IEquatable<PlayOptions>
- Inheritance
-
PlayOptions
- Implements
- Inherited Members
Constructors
PlayOptions(TimeSpan?, TimeSpan?, bool, JsonElement?, string?)
Options of a playback request issued through PlayAsync(Track, PlayOptions?, CancellationToken) or PlayIdentifierAsync(string, PlayOptions?, CancellationToken).
public PlayOptions(TimeSpan? StartPosition = null, TimeSpan? EndTime = null, bool NoReplace = false, JsonElement? UserData = null, string? AudioTrackId = null)
Parameters
StartPositionTimeSpan?Starts playback at the given position, null falls back to the track's own start offset (a timestamped link) or the beginning when it has none. Must not be negative and must come before the end time, every play entry point validates and throws up front.
EndTimeTimeSpan?Stops playback at the given position, null plays to the end. Must be greater than zero and after the start position, every play entry point validates and throws up front.
NoReplaceboolWhen true, does not replace a track that is already playing.
UserDataJsonElement?Client data the server attaches to the track and echoes back. Must be a JSON object when set. Lavalink rejects any other kind, so the play methods throw ArgumentException up front.
AudioTrackIdstringSelects a dub or alternate audio track on sources that expose more than one. NodeLink only, not with PlayIdentifierAsync(string, PlayOptions?, CancellationToken), which is Lavalink only.
Properties
AudioTrackId
Selects a dub or alternate audio track on sources that expose more than one. NodeLink only, not with PlayIdentifierAsync(string, PlayOptions?, CancellationToken), which is Lavalink only.
public string? AudioTrackId { get; init; }
Property Value
EndTime
Stops playback at the given position, null plays to the end. Must be greater than zero and after the start position, every play entry point validates and throws up front.
public TimeSpan? EndTime { get; init; }
Property Value
NoReplace
When true, does not replace a track that is already playing.
public bool NoReplace { get; init; }
Property Value
StartPosition
Starts playback at the given position, null falls back to the track's own start offset (a timestamped link) or the beginning when it has none. Must not be negative and must come before the end time, every play entry point validates and throws up front.
public TimeSpan? StartPosition { get; init; }
Property Value
UserData
Client data the server attaches to the track and echoes back. Must be a JSON object when set. Lavalink rejects any other kind, so the play methods throw ArgumentException up front.
public JsonElement? UserData { get; init; }
Property Value
Methods
Equals(PlayOptions?)
Indicates whether both options select the same playback with the same raw client data.
public bool Equals(PlayOptions? other)
Parameters
otherPlayOptionsThe options to compare with.
Returns
- bool
Whether the members match, the raw data compared by content.
GetHashCode()
Returns a hash of the comparable members, the raw data stays out of it.
public override int GetHashCode()
Returns
- int
The hash code.