ISessionManager.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Controller.Library;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Threading.Tasks;
  6. using MediaBrowser.Model.Session;
  7. namespace MediaBrowser.Controller.Session
  8. {
  9. /// <summary>
  10. /// Interface ISessionManager
  11. /// </summary>
  12. public interface ISessionManager
  13. {
  14. /// <summary>
  15. /// Occurs when [playback start].
  16. /// </summary>
  17. event EventHandler<PlaybackProgressEventArgs> PlaybackStart;
  18. /// <summary>
  19. /// Occurs when [playback progress].
  20. /// </summary>
  21. event EventHandler<PlaybackProgressEventArgs> PlaybackProgress;
  22. /// <summary>
  23. /// Occurs when [playback stopped].
  24. /// </summary>
  25. event EventHandler<PlaybackProgressEventArgs> PlaybackStopped;
  26. /// <summary>
  27. /// Gets all connections.
  28. /// </summary>
  29. /// <value>All connections.</value>
  30. IEnumerable<SessionInfo> AllConnections { get; }
  31. /// <summary>
  32. /// Gets the active connections.
  33. /// </summary>
  34. /// <value>The active connections.</value>
  35. IEnumerable<SessionInfo> RecentConnections { get; }
  36. /// <summary>
  37. /// Logs the user activity.
  38. /// </summary>
  39. /// <param name="clientType">Type of the client.</param>
  40. /// <param name="deviceId">The device id.</param>
  41. /// <param name="deviceName">Name of the device.</param>
  42. /// <param name="user">The user.</param>
  43. /// <returns>Task.</returns>
  44. /// <exception cref="System.ArgumentNullException">user</exception>
  45. Task LogConnectionActivity(string clientType, string deviceId, string deviceName, User user);
  46. /// <summary>
  47. /// Used to report that playback has started for an item
  48. /// </summary>
  49. /// <param name="user">The user.</param>
  50. /// <param name="item">The item.</param>
  51. /// <param name="clientType">Type of the client.</param>
  52. /// <param name="deviceId">The device id.</param>
  53. /// <param name="deviceName">Name of the device.</param>
  54. /// <exception cref="System.ArgumentNullException"></exception>
  55. void OnPlaybackStart(User user, BaseItem item, string clientType, string deviceId, string deviceName);
  56. /// <summary>
  57. /// Used to report playback progress for an item
  58. /// </summary>
  59. /// <param name="user">The user.</param>
  60. /// <param name="item">The item.</param>
  61. /// <param name="positionTicks">The position ticks.</param>
  62. /// <param name="clientType">Type of the client.</param>
  63. /// <param name="deviceId">The device id.</param>
  64. /// <param name="deviceName">Name of the device.</param>
  65. /// <returns>Task.</returns>
  66. /// <exception cref="System.ArgumentNullException"></exception>
  67. Task OnPlaybackProgress(User user, BaseItem item, long? positionTicks, string clientType, string deviceId, string deviceName);
  68. /// <summary>
  69. /// Used to report that playback has ended for an item
  70. /// </summary>
  71. /// <param name="user">The user.</param>
  72. /// <param name="item">The item.</param>
  73. /// <param name="positionTicks">The position ticks.</param>
  74. /// <param name="clientType">Type of the client.</param>
  75. /// <param name="deviceId">The device id.</param>
  76. /// <param name="deviceName">Name of the device.</param>
  77. /// <returns>Task.</returns>
  78. /// <exception cref="System.ArgumentNullException"></exception>
  79. Task OnPlaybackStopped(User user, BaseItem item, long? positionTicks, string clientType, string deviceId, string deviceName);
  80. }
  81. }