2
0

BufferGroupRequest.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #nullable disable
  2. using System;
  3. using System.Threading;
  4. using MediaBrowser.Controller.Session;
  5. using MediaBrowser.Model.SyncPlay;
  6. namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
  7. {
  8. /// <summary>
  9. /// Class BufferGroupRequest.
  10. /// </summary>
  11. public class BufferGroupRequest : AbstractPlaybackRequest
  12. {
  13. /// <summary>
  14. /// Initializes a new instance of the <see cref="BufferGroupRequest"/> class.
  15. /// </summary>
  16. /// <param name="when">When the request has been made, as reported by the client.</param>
  17. /// <param name="positionTicks">The position ticks.</param>
  18. /// <param name="isPlaying">Whether the client playback is unpaused.</param>
  19. /// <param name="playlistItemId">The playlist item identifier of the playing item.</param>
  20. public BufferGroupRequest(DateTime when, long positionTicks, bool isPlaying, Guid playlistItemId)
  21. {
  22. When = when;
  23. PositionTicks = positionTicks;
  24. IsPlaying = isPlaying;
  25. PlaylistItemId = playlistItemId;
  26. }
  27. /// <summary>
  28. /// Gets when the request has been made by the client.
  29. /// </summary>
  30. /// <value>The date of the request.</value>
  31. public DateTime When { get; }
  32. /// <summary>
  33. /// Gets the position ticks.
  34. /// </summary>
  35. /// <value>The position ticks.</value>
  36. public long PositionTicks { get; }
  37. /// <summary>
  38. /// Gets a value indicating whether the client playback is unpaused.
  39. /// </summary>
  40. /// <value>The client playback status.</value>
  41. public bool IsPlaying { get; }
  42. /// <summary>
  43. /// Gets the playlist item identifier of the playing item.
  44. /// </summary>
  45. /// <value>The playlist item identifier.</value>
  46. public Guid PlaylistItemId { get; }
  47. /// <inheritdoc />
  48. public override PlaybackRequestType Action { get; } = PlaybackRequestType.Buffer;
  49. /// <inheritdoc />
  50. public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
  51. {
  52. state.HandleRequest(this, context, state.Type, session, cancellationToken);
  53. }
  54. }
  55. }