Class MrpPushUpdater
- Namespace
- AppleTvControlLibrary.Mrp.PlayerState
- Assembly
- AppleTvControlLibrary.Mrp.dll
Forwards MrpPlayerStateManager updates for the active client/player to a
registered IMrpPushUpdaterListener, mirroring pyatv's MrpPushUpdater.
public sealed class MrpPushUpdater : IMrpPlayerStateListener
- Inheritance
-
MrpPushUpdater
- Implements
- Inherited Members
Remarks
Unlike pyatv, which installs itself as PlayerStateManager.listener and receives a
no-argument callback (reading self.psm.playing itself), this type both installs itself
as IMrpPlayerStateListener and does the "read playing" step, since that is exactly
what pyatv's state_updated() does synchronously before dispatch.
Constructors
MrpPushUpdater(MrpPlayerStateManager)
Forwards MrpPlayerStateManager updates for the active client/player to a
registered IMrpPushUpdaterListener, mirroring pyatv's MrpPushUpdater.
public MrpPushUpdater(MrpPlayerStateManager psm)
Parameters
psmMrpPlayerStateManagerThe player state manager to source updates from.
Remarks
Unlike pyatv, which installs itself as PlayerStateManager.listener and receives a
no-argument callback (reading self.psm.playing itself), this type both installs itself
as IMrpPlayerStateListener and does the "read playing" step, since that is exactly
what pyatv's state_updated() does synchronously before dispatch.
Properties
Active
Gets a value indicating whether this instance is currently registered to receive push updates.
public bool Active { get; }
Property Value
- bool
A value indicating whether this instance is currently registered to receive push updates.
Listener
Gets or sets the listener notified of push updates and errors.
public IMrpPushUpdaterListener? Listener { get; set; }
Property Value
- IMrpPushUpdaterListener
The listener notified of push updates and errors.
Methods
Start()
Starts forwarding push updates from the device to Listener, immediately delivering the current state once.
public void Start()
Exceptions
- MrpNoAsyncListenerException
No Listener has been set.
StateUpdated()
Reports the current playing state to the listener, or reports an error if building the update fails.
public void StateUpdated()
Stop()
Stops forwarding push updates to Listener.
public void Stop()