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
Properties
Client
Gets the currently active client, or null if none is active.
public MrpClient? Client { get; }
Property Value
Listener
Gets or sets the listener notified when relevant player state changes.
public IMrpPlayerStateListener? Listener { get; set; }
Property Value
- IMrpPlayerStateListener
The listener notified when relevant player state changes.
Playing
Gets the player state for the active media player.
public MrpPlayerState Playing { get; }
Property Value
- MrpPlayerState
The player state for the active media player.
VolumeControlAbsolute
Gets a value indicating whether absolute volume control is available.
public bool VolumeControlAbsolute { get; }
Property Value
- bool
A value indicating whether absolute volume control is available.
VolumeControlAvailable
Gets a value indicating whether the device currently reports volume control as available.
public bool VolumeControlAvailable { get; }
Property Value
- bool
A value indicating whether the device currently reports volume control as available.
VolumeControlRelative
Gets a value indicating whether relative volume control is available.
public bool VolumeControlRelative { get; }
Property Value
- bool
A value indicating whether relative volume control is available.
Methods
GetClient(NowPlayingClient)
Returns the client for a given NowPlayingClient, creating it if needed.
public MrpClient GetClient(NowPlayingClient client)
Parameters
clientNowPlayingClientThe client identity to look up.
Returns
- MrpClient
The existing or newly created client state for the requested identity.
GetPlayer(PlayerPath)
Returns the player for a given PlayerPath.
public MrpPlayerState GetPlayer(PlayerPath playerPath)
Parameters
playerPathPlayerPathThe player path to resolve.
Returns
- MrpPlayerState
The existing or newly created state for the requested player.
MessageReceived(ProtocolMessage)
Updates tracked player and client state from an incoming MRP message.
public void MessageReceived(ProtocolMessage message)
Parameters
messageProtocolMessageThe received protocol message.