Table of Contents

Class MrpPlayerStateManager

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

Manages state of all media players, dispatching MRP state-update messages onto MrpClient/MrpPlayerState instances and notifying a listener whenever state relevant to the active client/player changes.

public sealed class MrpPlayerStateManager : IMrpProtocolListener
Inheritance
MrpPlayerStateManager
Implements
Inherited Members

Remarks

Implements IMrpProtocolListener directly and should be assigned to Listener (or chained via a multiplexing listener), since MrpProtocol — unlike pyatv's MessageDispatcher — exposes a single unsolicited-message sink rather than per-type registration.

Fields

DefaultPlayerId

The identifier used by MediaRemote for the default (queue-less) player.

public const string DefaultPlayerId = "MediaRemote-DefaultPlayer"

Field Value

string

Properties

Client

Gets the currently active client, or null if none is active.

public MrpClient? Client { get; }

Property Value

MrpClient

Listener

Gets or sets the listener notified when relevant player state changes.

public IMrpPlayerStateListener? Listener { get; set; }

Property Value

IMrpPlayerStateListener

Playing

Gets the player state for the active media player.

public MrpPlayerState Playing { get; }

Property Value

MrpPlayerState

VolumeControlAbsolute

Gets a value indicating whether absolute volume control is available.

public bool VolumeControlAbsolute { get; }

Property Value

bool

VolumeControlAvailable

Gets a value indicating whether the device currently reports volume control as available.

public bool VolumeControlAvailable { get; }

Property Value

bool

VolumeControlRelative

Gets a value indicating whether relative volume control is available.

public bool VolumeControlRelative { get; }

Property Value

bool

Methods

GetClient(NowPlayingClient)

Returns the client for a given NowPlayingClient, creating it if needed.

public MrpClient GetClient(NowPlayingClient client)

Parameters

client NowPlayingClient

The client identity to look up.

Returns

MrpClient

GetPlayer(PlayerPath)

Returns the player for a given PlayerPath.

public MrpPlayerState GetPlayer(PlayerPath playerPath)

Parameters

playerPath PlayerPath

The player path to resolve.

Returns

MrpPlayerState

MessageReceived(ProtocolMessage)

An unsolicited message was received from the device.

public void MessageReceived(ProtocolMessage message)

Parameters

message ProtocolMessage

The decoded message.