Table of Contents

Class MrpPlayerState

Namespace
AppleTvControlLibrary.Mrp.PlayerState
Assembly
AppleTvControlLibrary.Mrp.dll

Represents what is currently playing for a single player.

public sealed class MrpPlayerState
Inheritance
MrpPlayerState
Inherited Members

Constructors

MrpPlayerState(MrpClient, NowPlayingPlayer)

Initializes a new instance of the MrpPlayerState class.

public MrpPlayerState(MrpClient parent, NowPlayingPlayer player)

Parameters

parent MrpClient

The client that owns this player.

player NowPlayingPlayer

The player identity to initialize from.

Properties

DisplayName

Gets the player's display name.

public string? DisplayName { get; }

Property Value

string

The player's display name.

IconUrl

Gets the icon URL reported for this player, if any. This is a raw wire-format field (NowPlayingPlayer.proto, field 7: iconURL) that pyatv 0.18.0 receives but never reads or exposes anywhere in its Python source — there is no reference behavior to port for it, so it is surfaced here unprocessed rather than approximated.

public string? IconUrl { get; }

Property Value

string

The icon URL reported for this player, if any. This is a raw wire-format field (NowPlayingPlayer.proto, field 7: iconURL) that pyatv 0.18.0 receives but never reads or exposes anywhere in its Python source — there is no reference behavior to port for it, so it is surfaced here unprocessed rather than approximated.

Identifier

Gets the player identifier.

public string? Identifier { get; }

Property Value

string

The player identifier.

IsValid

Gets a value indicating whether this player has a valid (non-empty) identifier.

public bool IsValid { get; }

Property Value

bool

A value indicating whether this player has a valid (non-empty) identifier.

ItemIdentifier

Gets the identifier of the current item in the queue.

public string? ItemIdentifier { get; }

Property Value

string

The identifier of the current item in the queue.

Items

Gets the current playback queue items.

public List<ContentItem> Items { get; }

Property Value

List<ContentItem>

The current playback queue items.

Location

Gets the current location (index) within Items.

public int Location { get; }

Property Value

int

The current location (index) within Items.

Metadata

Gets the metadata of the currently playing item, if any.

public ContentItemMetadata? Metadata { get; }

Property Value

ContentItemMetadata

The metadata of the currently playing item, if any.

Parent

Gets the client that owns this player.

public MrpClient? Parent { get; }

Property Value

MrpClient

The client that owns this player.

PlaybackStateValue

Gets the playback state of the device, applying pyatv's playback-rate disambiguation.

public PlaybackState.Types.Enum? PlaybackStateValue { get; }

Property Value

PlaybackState.Types.Enum?

The playback state of the device, applying pyatv's playback-rate disambiguation.

Position

Gets the current position in the playing media in seconds, or null if unknown.

public int? Position { get; }

Property Value

int?

The current position in the playing media in seconds, or null if unknown.

SupportedCommands

Gets the supported commands reported directly on this player.

public List<CommandInfo> SupportedCommands { get; }

Property Value

List<CommandInfo>

The supported commands reported directly on this player.

TotalTime

Gets the total play time in seconds, or null if unknown.

public int? TotalTime { get; }

Property Value

int?

The total play time in seconds, or null if unknown.

Methods

CommandInfoFor(Command)

Returns supported command info for the given command, checking this player and then the parent client.

public CommandInfo? CommandInfoFor(Command command)

Parameters

command Command

The command to look up.

Returns

CommandInfo

The matching command information from this player or its parent client, or null if unsupported.

HandleContentItemUpdate(UpdateContentItemMessage)

Updates current state with new data from an UPDATE_CONTENT_ITEM_MESSAGE.

public void HandleContentItemUpdate(UpdateContentItemMessage itemUpdate)

Parameters

itemUpdate UpdateContentItemMessage

The decoded UpdateContentItemMessage.

HandleSetState(SetStateMessage)

Updates current state with new data from a SET_STATE_MESSAGE.

public void HandleSetState(SetStateMessage setState)

Parameters

setState SetStateMessage

The decoded SetStateMessage.

MetadataField<T>(string)

Returns a specific metadata field, or null if missing.

public T? MetadataField<T>(string field)

Parameters

field string

The metadata field name.

Returns

T

The field value cast to the requested type, or the default value of that type if the metadata, field, or compatible value is unavailable.

Type Parameters

T

The expected field type.

Update(NowPlayingPlayer)

Updates player metadata from a NowPlayingPlayer payload.

public void Update(NowPlayingPlayer player)

Parameters

player NowPlayingPlayer

The player identity to update from.