using System.Threading; using MediaBrowser.Model.SyncPlay; using MediaBrowser.Controller.Session; namespace MediaBrowser.Controller.SyncPlay { /// /// Interface ISyncPlayState. /// public interface ISyncPlayState { /// /// Gets the group state. /// /// The group state. GroupState GetGroupState(); /// /// Handle a session that joined the group. /// /// The context of the state. /// The previous state. /// The session. /// The cancellation token. void SessionJoined(ISyncPlayStateContext context, GroupState prevState, SessionInfo session, CancellationToken cancellationToken); /// /// Handle a session that is leaving the group. /// /// The context of the state. /// The previous state. /// The session. /// The cancellation token. void SessionLeaving(ISyncPlayStateContext context, GroupState prevState, SessionInfo session, CancellationToken cancellationToken); /// /// Generic handle. Context's state can change. /// /// The context of the state. /// The previous state. /// The generic action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, IPlaybackGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a play action requested by a session. Context's state can change. /// /// The context of the state. /// The previous state. /// The play action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, PlayGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a playlist-item change requested by a session. Context's state can change. /// /// The context of the state. /// The previous state. /// The playlist-item change action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, SetPlaylistItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a remove-items change requested by a session. Context's state can change. /// /// The context of the state. /// The previous state. /// The remove-items change action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, RemoveFromPlaylistGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a move-item change requested by a session. Context's state should not change. /// /// The context of the state. /// The previous state. /// The move-item change action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, MovePlaylistItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a queue change requested by a session. Context's state should not change. /// /// The context of the state. /// The previous state. /// The queue action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, QueueGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles an unpause action requested by a session. Context's state can change. /// /// The context of the state. /// The previous state. /// The unpause action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, UnpauseGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a pause action requested by a session. Context's state can change. /// /// The context of the state. /// The previous state. /// The pause action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, PauseGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a stop action requested by a session. Context's state can change. /// /// The context of the state. /// The previous state. /// The stop action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, StopGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a seek action requested by a session. Context's state can change. /// /// The context of the state. /// The previous state. /// The seek action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, SeekGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a buffering action requested by a session. Context's state can change. /// /// The context of the state. /// The previous state. /// The buffering action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, BufferGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a buffering-done action requested by a session. Context's state can change. /// /// The context of the state. /// The previous state. /// The buffering-done action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, ReadyGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a next-track action requested by a session. Context's state can change. /// /// The context of the state. /// The previous state. /// The next-track action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, NextTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a previous-track action requested by a session. Context's state can change. /// /// The context of the state. /// The previous state. /// The previous-track action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, PreviousTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a repeat-mode change requested by a session. Context's state should not change. /// /// The context of the state. /// The previous state. /// The repeat-mode action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, SetRepeatModeGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Handles a shuffle-mode change requested by a session. Context's state should not change. /// /// The context of the state. /// The previous state. /// The shuffle-mode action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, SetShuffleModeGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Updates ping of a session. Context's state should not change. /// /// The context of the state. /// The previous state. /// The buffering-done action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, PingGroupRequest request, SessionInfo session, CancellationToken cancellationToken); /// /// Updates whether the session should be considered during group wait. Context's state should not change. /// /// The context of the state. /// The previous state. /// The ignore-wait action. /// The session. /// The cancellation token. void HandleRequest(ISyncPlayStateContext context, GroupState prevState, IgnoreWaitGroupRequest request, SessionInfo session, CancellationToken cancellationToken); } }