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

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

Identifier

Gets the player identifier.

public string? Identifier { get; }

Property Value

string

IsValid

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

public bool IsValid { get; }

Property Value

bool

ItemIdentifier

Gets the identifier of the current item in the queue.

public string? ItemIdentifier { get; }

Property Value

string

Items

Gets the current playback queue items.

public List<ContentItem> Items { get; }

Property Value

List<ContentItem>

Location

Gets the current location (index) within Items.

public int Location { get; }

Property Value

int

Metadata

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

public ContentItemMetadata? Metadata { get; }

Property Value

ContentItemMetadata

Parent

Gets the client that owns this player.

public MrpClient? Parent { get; }

Property Value

MrpClient

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?

Position

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

public int? Position { get; }

Property Value

int?

SupportedCommands

Gets the supported commands reported directly on this player.

public List<CommandInfo> SupportedCommands { get; }

Property Value

List<CommandInfo>

TotalTime

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

public int? TotalTime { get; }

Property Value

int?

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

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

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.