Table of Contents

Class PlayerState

Namespace
Nyra.Entities
Assembly
Nyra.dll

Player state, delivered through playerUpdate operations and player REST responses.

public sealed record PlayerState : IEquatable<PlayerState>
Inheritance
PlayerState
Implements
Inherited Members

Properties

Connected

Whether the node is connected to the Discord voice gateway.

[JsonPropertyName("connected")]
[JsonInclude]
public bool Connected { get; }

Property Value

bool

Ping

Voice gateway latency in milliseconds.

[JsonPropertyName("ping")]
[JsonInclude]
public long Ping { get; }

Property Value

long

Remarks

Lavalink reports -1 and NodeLink 0 when not connected.

Position

The playback position the server reported, zero for a live stream, whose raw marker is PositionMilliseconds.

[JsonIgnore]
public TimeSpan Position { get; }

Property Value

TimeSpan

PositionMilliseconds

Playback position in milliseconds, 0 when nothing is playing, or the live-stream marker (MaxValue) on NodeLink streams.

[JsonPropertyName("position")]
[JsonInclude]
[JsonConverter(typeof(RoundedInt64Converter))]
public long PositionMilliseconds { get; }

Property Value

long

Remarks

Position reports zero for it.

Time

When the server reported the state.

[JsonIgnore]
public DateTimeOffset Time { get; }

Property Value

DateTimeOffset

Remarks

MinValue when the epoch value is out of the convertible range. The degenerate in-range value Nyra.UnixTime.MinMilliseconds converts to exactly MinValue too, so the sentinel cannot be told apart from it.

TimeMilliseconds

Unix timestamp, in milliseconds.

[JsonPropertyName("time")]
[JsonInclude]
public long TimeMilliseconds { get; }

Property Value

long