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
parentMrpClientThe client that owns this player.
playerNowPlayingPlayerThe player identity to initialize from.
Properties
DisplayName
Gets the player's display name.
public string? DisplayName { get; }
Property Value
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
Identifier
Gets the player identifier.
public string? Identifier { get; }
Property Value
IsValid
Gets a value indicating whether this player has a valid (non-empty) identifier.
public bool IsValid { get; }
Property Value
ItemIdentifier
Gets the identifier of the current item in the queue.
public string? ItemIdentifier { get; }
Property Value
Items
Gets the current playback queue items.
public List<ContentItem> Items { get; }
Property Value
Location
Gets the current location (index) within Items.
public int Location { get; }
Property Value
Metadata
Gets the metadata of the currently playing item, if any.
public ContentItemMetadata? Metadata { get; }
Property Value
Parent
Gets the client that owns this player.
public MrpClient? Parent { get; }
Property Value
PlaybackStateValue
Gets the playback state of the device, applying pyatv's playback-rate disambiguation.
public PlaybackState.Types.Enum? PlaybackStateValue { get; }
Property Value
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
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
commandCommandThe command to look up.
Returns
HandleContentItemUpdate(UpdateContentItemMessage)
Updates current state with new data from an UPDATE_CONTENT_ITEM_MESSAGE.
public void HandleContentItemUpdate(UpdateContentItemMessage itemUpdate)
Parameters
itemUpdateUpdateContentItemMessageThe decoded UpdateContentItemMessage.
HandleSetState(SetStateMessage)
Updates current state with new data from a SET_STATE_MESSAGE.
public void HandleSetState(SetStateMessage setState)
Parameters
setStateSetStateMessageThe decoded SetStateMessage.
MetadataField<T>(string)
Returns a specific metadata field, or null if missing.
public T? MetadataField<T>(string field)
Parameters
fieldstringThe metadata field name.
Returns
- T
Type Parameters
TThe expected field type.
Update(NowPlayingPlayer)
Updates player metadata from a NowPlayingPlayer payload.
public void Update(NowPlayingPlayer player)
Parameters
playerNowPlayingPlayerThe player identity to update from.