#nullable disable #pragma warning disable CS1591 using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Jellyfin.Data.Entities.Security; using MediaBrowser.Controller.Authentication; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Session; using MediaBrowser.Model.SyncPlay; namespace MediaBrowser.Controller.Session { /// /// Interface ISessionManager. /// public interface ISessionManager { /// /// Occurs when [playback start]. /// event EventHandler PlaybackStart; /// /// Occurs when [playback progress]. /// event EventHandler PlaybackProgress; /// /// Occurs when [playback stopped]. /// event EventHandler PlaybackStopped; /// /// Occurs when [session started]. /// event EventHandler SessionStarted; /// /// Occurs when [session ended]. /// event EventHandler SessionEnded; event EventHandler SessionActivity; /// /// Occurs when [session controller connected]. /// event EventHandler SessionControllerConnected; /// /// Occurs when [capabilities changed]. /// event EventHandler CapabilitiesChanged; /// /// Gets the sessions. /// /// The sessions. IEnumerable Sessions { get; } /// /// Logs the user activity. /// /// Type of the client. /// The app version. /// The device id. /// Name of the device. /// The remote end point. /// The user. /// A task containing the session information. Task LogSessionActivity(string appName, string appVersion, string deviceId, string deviceName, string remoteEndPoint, Jellyfin.Data.Entities.User user); /// /// Used to report that a session controller has connected. /// /// The session. void OnSessionControllerConnected(SessionInfo session); void UpdateDeviceName(string sessionId, string reportedDeviceName); /// /// Used to report that playback has started for an item. /// /// The info. /// Task. Task OnPlaybackStart(PlaybackStartInfo info); /// /// Used to report playback progress for an item. /// /// The info. /// Task. /// Throws if an argument is null. Task OnPlaybackProgress(PlaybackProgressInfo info); Task OnPlaybackProgress(PlaybackProgressInfo info, bool isAutomated); /// /// Used to report that playback has ended for an item. /// /// The info. /// Task. /// Throws if an argument is null. Task OnPlaybackStopped(PlaybackStopInfo info); /// /// Reports the session ended. /// /// The session identifier. void ReportSessionEnded(string sessionId); /// /// Sends the general command. /// /// The controlling session identifier. /// The session identifier. /// The command. /// The cancellation token. /// Task. Task SendGeneralCommand(string controllingSessionId, string sessionId, GeneralCommand command, CancellationToken cancellationToken); /// /// Sends the message command. /// /// The controlling session identifier. /// The session id. /// The command. /// The cancellation token. /// Task. Task SendMessageCommand(string controllingSessionId, string sessionId, MessageCommand command, CancellationToken cancellationToken); /// /// Sends the play command. /// /// The controlling session identifier. /// The session id. /// The command. /// The cancellation token. /// Task. Task SendPlayCommand(string controllingSessionId, string sessionId, PlayRequest command, CancellationToken cancellationToken); /// /// Sends a SyncPlayCommand to a session. /// /// The identifier of the session. /// The command. /// The cancellation token. /// Task. Task SendSyncPlayCommand(string sessionId, SendCommand command, CancellationToken cancellationToken); /// /// Sends a SyncPlayGroupUpdate to a session. /// /// The identifier of the session. /// The group update. /// The cancellation token. /// Type of group. /// Task. Task SendSyncPlayGroupUpdate(string sessionId, GroupUpdate command, CancellationToken cancellationToken); /// /// Sends the browse command. /// /// The controlling session identifier. /// The session id. /// The command. /// The cancellation token. /// Task. Task SendBrowseCommand(string controllingSessionId, string sessionId, BrowseRequest command, CancellationToken cancellationToken); /// /// Sends the playstate command. /// /// The controlling session identifier. /// The session id. /// The command. /// The cancellation token. /// Task. Task SendPlaystateCommand(string controllingSessionId, string sessionId, PlaystateRequest command, CancellationToken cancellationToken); /// /// Sends the message to admin sessions. /// /// Type of data. /// Message type name. /// The data. /// The cancellation token. /// Task. Task SendMessageToAdminSessions(SessionMessageType name, T data, CancellationToken cancellationToken); /// /// Sends the message to user sessions. /// /// Type of data. /// Users to send messages to. /// Message type name. /// The data. /// The cancellation token. /// Task. Task SendMessageToUserSessions(List userIds, SessionMessageType name, T data, CancellationToken cancellationToken); /// /// Sends the message to user sessions. /// /// Type of data. /// Users to send messages to. /// Message type name. /// Data function. /// The cancellation token. /// Task. Task SendMessageToUserSessions(List userIds, SessionMessageType name, Func dataFn, CancellationToken cancellationToken); /// /// Sends the message to user device sessions. /// /// Type of data. /// The device identifier. /// Message type name. /// The data. /// The cancellation token. /// Task. Task SendMessageToUserDeviceSessions(string deviceId, SessionMessageType name, T data, CancellationToken cancellationToken); /// /// Sends the restart required message. /// /// The cancellation token. /// Task. Task SendRestartRequiredNotification(CancellationToken cancellationToken); /// /// Adds the additional user. /// /// The session identifier. /// The user identifier. void AddAdditionalUser(string sessionId, Guid userId); /// /// Removes the additional user. /// /// The session identifier. /// The user identifier. void RemoveAdditionalUser(string sessionId, Guid userId); /// /// Reports the now viewing item. /// /// The session identifier. /// The item identifier. void ReportNowViewingItem(string sessionId, string itemId); /// /// Authenticates the new session. /// /// The request. /// Task{SessionInfo}. Task AuthenticateNewSession(AuthenticationRequest request); Task AuthenticateDirect(AuthenticationRequest request); /// /// Reports the capabilities. /// /// The session identifier. /// The capabilities. void ReportCapabilities(string sessionId, ClientCapabilities capabilities); /// /// Reports the transcoding information. /// /// The device identifier. /// The information. void ReportTranscodingInfo(string deviceId, TranscodingInfo info); /// /// Clears the transcoding information. /// /// The device identifier. void ClearTranscodingInfo(string deviceId); /// /// Gets the session. /// /// The device identifier. /// The client. /// The version. /// SessionInfo. SessionInfo GetSession(string deviceId, string client, string version); /// /// Gets the session by authentication token. /// /// The token. /// The device identifier. /// The remote endpoint. /// SessionInfo. Task GetSessionByAuthenticationToken(string token, string deviceId, string remoteEndpoint); /// /// Gets the session by authentication token. /// /// The information. /// The device identifier. /// The remote endpoint. /// The application version. /// Task<SessionInfo>. Task GetSessionByAuthenticationToken(Device info, string deviceId, string remoteEndpoint, string appVersion); /// /// Logouts the specified access token. /// /// The access token. /// A representing the log out process. Task Logout(string accessToken); Task Logout(Device device); /// /// Revokes the user tokens. /// /// The user's id. /// The current access token. /// Task. Task RevokeUserTokens(Guid userId, string currentAccessToken); Task CloseIfNeededAsync(SessionInfo session); } }