using System; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.SyncPlay; using MediaBrowser.Controller.Session; namespace MediaBrowser.Controller.SyncPlay { /// /// Interface ISyncPlayStateContext. /// public interface ISyncPlayStateContext { /// /// Gets the context's group. /// /// The group. GroupInfo GetGroup(); /// /// Sets a new state. /// /// The new state. void SetState(ISyncPlayState state); /// /// Sends a GroupUpdate message to the interested sessions. /// /// The current session. /// The filtering type. /// The message to send. /// The cancellation token. /// The task. Task SendGroupUpdate(SessionInfo from, SyncPlayBroadcastType type, GroupUpdate message, CancellationToken cancellationToken); /// /// Sends a playback command to the interested sessions. /// /// The current session. /// The filtering type. /// The message to send. /// The cancellation token. /// The task. Task SendCommand(SessionInfo from, SyncPlayBroadcastType type, SendCommand message, CancellationToken cancellationToken); /// /// Builds a new playback command with some default values. /// /// The command type. /// The SendCommand. SendCommand NewSyncPlayCommand(SendCommandType type); /// /// Builds a new group update message. /// /// The update type. /// The data to send. /// The GroupUpdate. GroupUpdate NewSyncPlayGroupUpdate(GroupUpdateType type, T data); /// /// Converts DateTime to UTC string. /// /// The date to convert. /// The UTC string. string DateToUTCString(DateTime date); /// /// Sanitizes the PositionTicks, considers the current playing item when available. /// /// The PositionTicks. /// The sanitized PositionTicks. long SanitizePositionTicks(long? positionTicks); } }